Memory errors
Common error signatures
Failures in the memory subsystem fall into three categories: Redis connectivity, CLAUDE.md file loading, and security/permission violations.
Redis connectivity
OSError: REDIS_URL not found. Make sure Redis is added to your Railway project.\nRun: railway add --database redis\nFor external access, use REDIS_PUBLIC_URL— raised byget_railway_redis()when theREDIS_URLenvironment variable is absent. Add Redis to your Railway project or setREDIS_URLbefore calling this function.MemoryBackend.is_connected()returnsFalse— the backend initialized but cannot reach Redis. Check that your Redis host and port match the values inControlPanelConfig(default:localhost:6379) or the URL passed toget_redis_memory().
CLAUDE.md file loading
- Failures in
ClaudeMemoryLoader.load_all_memory()typically involve missing or unreadableCLAUDE.mdfiles.ClaudeMemoryConfig.validate_filescontrols whether files are checked before loading;max_import_depth(default:5) andmax_file_size_bytes(default:1 000 000) bound the import graph — exceeding either silently truncates or raises depending on the backend.
Security and permissions
MemoryPermissionError/SecurityError/ShortTermSecurityError— raised when a caller attempts an operation that violates the classification or access-tier rules defined inClassificationRules. The pattern'sClassificationlevel determines whichAccessTieris required.
Where errors originate
The following functions are the most common raise sites. Trace a failure back through the call stack to find which one is involved.
| Function | Module | What goes wrong |
|---|---|---|
get_railway_redis() |
memory/__init__.py |
Raises OSError when REDIS_URL is not set |
get_redis_memory() |
memory/config.py |
Fails if the URL is malformed or the environment is misconfigured |
parse_redis_url() |
memory/config.py |
Raises on an invalid Redis URL format |
get_redis_config() |
memory/config.py |
Returns stale or missing values when legacy environment variables are absent |
ClaudeMemoryLoader.load_all_memory() |
memory/claude_memory.py |
Fails on unreadable files, import cycles, or depth/size limit violations |
MemoryControlPanel.health_check() |
memory/control_panel.py |
Returns a degraded status dict when Redis or storage is unreachable |
check_redis_connection() |
memory/__init__.py |
Returns a status dict indicating connection failure; does not raise |
How to diagnose
-
Check the exception type first.
OSErrorpoints to a missing environment variable or an unreachable host.MemoryPermissionErrororSecurityErrorpoints to a classification mismatch.ValueErrorinparse_redis_url()points to a malformed connection string. -
Verify Redis availability before anything else. Call
is_redis_available()— it checks the Redis subsystem without importing it, so it is safe to call early. Then callcheck_redis_connection()for a detailed status dict that includes host, port, and reachability. -
Inspect
ControlPanelConfigand environment variables. Confirm thatredis_host,redis_port, andstorage_dirmatch your deployment. For Railway, confirm thatREDIS_URLis set;get_railway_redis()raises immediately if it is not. -
For CLAUDE.md failures, check
ClaudeMemoryConfig. CallClaudeMemoryLoader.get_loaded_files()to see which files were successfully loaded before the failure. Checkmax_import_depth(default:5) if you have nested imports, andmax_file_size_bytes(default:1 000 000) if you load large files. -
For permission errors, check the pattern's classification.
MemoryPermissionErrormeans the caller'sAccessTierdoes not satisfy the pattern'sClassification. Review theClassificationRulesin use and confirm the agent's credentials grant the required tier. -
Run
MemoryControlPanel.health_check(). This returns a dict covering Redis status, storage directory access, and audit log availability. A degraded result here usually explains upstream failures instash(),retrieve(), orsearch().
Source files
src/attune/memory/**
Tags: memory, storage