oraios/serena · error · ValueError
symbol_info_budget cannot be negative, got: {symbol_info_bud
Error message
symbol_info_budget cannot be negative, got: {symbol_info_budget} What it means
SerenaConfig._from_dict validates the optional symbol_info_budget setting from serena_config.yml. The raw value is parsed to float, and a negative number is rejected because a budget of symbols sent to the LLM cannot be below zero. This is a defensive config-validation error raised at config-parse time.
Source
Thrown at src/serena/config/serena_config.py:615
# Validate activation_command_timeout
activation_command_timeout_raw = data.get("activation_command_timeout", 180.0)
try:
activation_command_timeout = float(activation_command_timeout_raw)
except (TypeError, ValueError) as e:
raise ValueError(f"activation_command_timeout must be a number, got: {activation_command_timeout_raw}") from e
if activation_command_timeout <= 0:
raise ValueError(f"activation_command_timeout must be positive, got: {activation_command_timeout}")
# Validate symbol_info_budget
symbol_info_budget_raw = data["symbol_info_budget"]
symbol_info_budget = symbol_info_budget_raw
if symbol_info_budget is not None:
try:
symbol_info_budget = float(symbol_info_budget_raw)
except (TypeError, ValueError) as e:
raise ValueError(f"symbol_info_budget must be a number or null, got: {symbol_info_budget_raw}") from e
if symbol_info_budget < 0:
raise ValueError(f"symbol_info_budget cannot be negative, got: {symbol_info_budget}")
language_backend_value = data.get("language_backend")
language_backend = LanguageBackend.from_str(language_backend_value) if language_backend_value else None
line_ending_value = data.get("line_ending")
line_ending = LineEnding.from_str(line_ending_value) if line_ending_value else None
# gracefully handle user errors: incorrect use of None/empty where a list is required
ignored_paths = data["ignored_paths"] or []
fixed_tools = data["fixed_tools"] or []
excluded_tools = data["excluded_tools"] or []
included_optional_tools = data["included_optional_tools"] or []
additional_workspace_folders = data.get("ls_additional_workspace_folders") or []
if "base_modes" in data and data["base_modes"] is not None:
log.warning("The base_modes setting in project.yml is deprecated and will be ignored.")
return cls(View on GitHub (pinned to 7fcbca7e62)
Solutions
- Open serena_config.yml and set symbol_info_budget to a non-negative number (e.g. 5000) or remove/null the key to use the default.
- If building a dict programmatically, clamp or validate the value: max(0, value) before calling _from_dict.
- Check for locale/formatted strings that parse as negative after float() conversion.
Example fix
// before (serena_config.yml) symbol_info_budget: -1 // after symbol_info_budget: 5000
Defensive patterns
Strategy: validation
Validate before calling
def ensure_valid_budget(cfg: dict) -> None:
raw = cfg.get('symbol_info_budget')
if raw is not None:
v = float(raw)
if v < 0:
raise ValueError(f'symbol_info_budget must be >= 0, got {v}') Type guard
def has_valid_budget(cfg: dict) -> bool:
raw = cfg.get('symbol_info_budget')
return raw is None or (isinstance(raw, (int, float)) and not isinstance(raw, bool) and raw >= 0) Try / catch
try:
config = SerenaConfig.load()
except ValueError as e:
if 'symbol_info_budget' in str(e):
fix_budget_in_yml(); config = SerenaConfig.load()
else:
raise Prevention
- Never hand-write negative placeholder values in serena_config.yml
- Validate the yml with a schema check before loading
- Clamp numeric config values programmatically when generating configs
When it happens
Trigger: Calling SerenaConfig.load(), SerenaConfig.autogenerate(), or ProjectConfig._from_dict() when the symbol_info_budget key in serena_config.yml (or a dict passed to _from_dict) parses to a negative float, e.g. 'symbol_info_budget: -1'.
Common situations: Hand-editing serena_config.yml and typoing the value (e.g. '-1' as a placeholder, or a locale-style decimal like '-0,5' misinterpreted); test fixtures passing dicts with negative budgets; pasting config from an old version where the field meant something else.
Related errors
- Cannot use both fixed_tools and excluded_tools/included_opti
- Unknown language backend '{backend_str}': valid values are {
- Invalid line_ending: {value!r}. Valid values are: {valid}
- Invalid language server: '{orig_language_str}'.\nValid value
- activation_command_timeout must be a number, got: {activatio
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/5182668ae9c45864.
Report an issue: GitHub.