Repository navigation
Description
Bug Description
Basic Memory fails to start with a Pydantic validation error for log_level. The FastMCP Settings class expects uppercase log level values ('INFO') but receives lowercase ('info'), causing the MCP server to fail during initialization.
Steps To Reproduce
- Install Basic Memory version '0.14.3' using
uv - Configure project with default settings (log_level: "INFO" in config)
- Run Claude Code with Basic Memory MCP server configured
- See validation error and connection failure
Expected Behavior
Basic Memory should start successfully and connect to Claude Code without validation errors, regardless of log level case sensitivity.
Actual Behavior
MCP server fails to start with the following error:
pydantic_core._pydantic_core.ValidationError: 1 validation error for Settings
log_level
Input should be 'DEBUG', 'INFO', 'WARNING', 'ERROR' or 'CRITICAL' [type=literal_error, input_value='info', input_type=str]
The server connection closes immediately after this validation error.
Environment
- OS: macOS 15.6.1 Sequoia
- Python version: Managed by uv (Python 3.13 based on error traceback)
- Basic Memory version: 0.14.3
- Installation method: uv
- Claude Desktop version: Claude Code 1.0.93
Additional Context
- Configuration file shows uppercase
"log_level": "INFO" - Works perfectly with Claude Desktop and CLI
- Only fails in Claude Code environment
- Error occurs in FastMCP Settings initialization, suggesting the lowercase 'info' comes from somewhere other than the Basic Memory config
Configuration file:
{
"env": "dev",
"projects": {
7 projects
},
"default_project": "someproject",
"log_level": "INFO",
"sync_delay": 1000,
"update_permalinks_on_move": false,
"sync_changes": true,
"api_url": null
}Possible Solution
The issue appears to be in the FastMCP dependency where Settings() initialization receives a lowercase 'info' value from somewhere (possibly environment variables or Claude Code's MCP server configuration).
Potential fixes:
- Case-insensitive validation: Modify FastMCP Settings to accept both cases and normalize to uppercase
- Environment variable check: Ensure Claude Code doesn't set a lowercase LOG_LEVEL environment variable
- Basic Memory normalization: Add input normalization in Basic Memory before passing to FastMCP
- Dependency version pinning: Check if a recent FastMCP update introduced stricter validation
The root cause seems to be that while the Basic Memory config correctly uses uppercase "INFO", the FastMCP Settings class receives lowercase "info" from another source during Claude Code execution.
Activity
phernandez commentedon Aug 27, 2025
@SWSAmor this is annoying. I think what is going on may be that basic memory is picking up a .env file locally with a value for log_level and causing problems. Try running it from a directory that doesn't contain a .env file. This is certainly a bug and we are fixing it. But try that as a work around.
relates to: #227
phernandez commentedon Sep 26, 2025
@claude what is the issue here?
claude commentedon Sep 26, 2025
Claude finished @phernandez's task —— View job
Analysis Complete ✅
Todo List
The Issue Explained
The problem is a case-sensitivity mismatch in log level configuration between what FastMCP expects and what it receives in the Claude Code environment. Here's what's happening:
Basic Memory Configuration (
src/basic_memory/config.py):"BASIC_MEMORY_".envfiles via Pydantic'senv_file=".env"setting"INFO"(uppercase)The Root Cause:
'DEBUG', 'INFO', 'WARNING', 'ERROR', or 'CRITICAL'LOG_LEVELwithout theBASIC_MEMORY_prefix) with lowercase value'info'LOG_LEVELenvironment variable set by Claude Code.envfile in the working directory withLOG_LEVEL=infoWhy it works elsewhere:
LOG_LEVELenvironment variable"INFO"The Solution
As @phernandez mentioned, this is indeed a bug. The immediate workaround is to:
.envfile containing lowercase log levels.envfile uses uppercase log levels (LOG_LEVEL=INFOnotLOG_LEVEL=info)The proper fix would be to:
This issue is related to #227 as mentioned, where environment variable handling needs to be more robust.
Job Run: View Run
Branch: claude/issue-278-20250926-1441
phernandez commentedon Oct 4, 2025
Duplicate of #227 - Fixed by PR #330
This issue has the same root cause as #227. Basic Memory was automatically loading
.envfiles from the current working directory via Pydantic'senv_file=".env"setting.When you run Basic Memory from a directory containing a
.envfile withLOG_LEVEL=info(lowercase), it overrides the configuration and causes the validation error.Fix: PR #330 removes automatic
.envfile loading, which will resolve this issue.Workaround until the fix is released:
Run Basic Memory from a directory that doesn't contain a
.envfile, or ensure your.envfile uses uppercase:LOG_LEVEL=INFOClosing as duplicate of #227.
phernandez commentedon Oct 4, 2025
Fixed by PR #330