oraios/serena · error · ValueError

activation_command_timeout must be positive, got: {activatio

Error message

activation_command_timeout must be positive, got: {activation_command_timeout}

What it means

After successfully parsing activation_command_timeout to a float, _from_dict enforces that it is strictly greater than zero; a zero or negative value raises ValueError. A non-positive timeout would make the language-server activation wait immediately expire, so the library rejects it at config-load time.

Source

Thrown at src/serena/config/serena_config.py:604

            try:
                ls_str = ls_str.lower()
                if ls_str in lang_name_mapping:
                    ls_str = lang_name_mapping[ls_str]
                ls_id = LanguageServerId(ls_str)
                ls_ids.append(ls_id)
            except ValueError as e:
                raise ValueError(
                    f"Invalid language server: '{orig_language_str}'.\nValid values are: {[l.value for l in LanguageServerId]}"
                ) from e

        # 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

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Set the timeout to a positive number of seconds, e.g. activation_command_timeout: 180 (the default) or higher for slow language servers
  2. If you wanted to skip the activation command, remove the command/timeout rather than zeroing the timeout
  3. Validate inputs before calling autogenerate: assert float(v) > 0

Example fix

// before (project.yml)
activation_command_timeout: 0
// after (project.yml)
activation_command_timeout: 180.0
Defensive patterns

Strategy: validation

Validate before calling

timeout = float(data.get("activation_command_timeout", 180.0))
if timeout <= 0:
    raise ValueError(f"activation_command_timeout must be > 0, got {timeout}")

Type guard

def is_positive_number(v) -> bool:
    return isinstance(v, (int, float)) and not isinstance(v, bool) and v > 0

Try / catch

try:
    config = ProjectConfig.load(project_root)
except ValueError as e:
    if 'activation_command_timeout must be positive' in str(e):
        logger.warning("Resetting activation_command_timeout to default 180.0")
        # patch the yml or proceed with defaults
    raise

Prevention

When it happens

Trigger: ProjectConfig.autogenerate(..., activation_command_timeout=0) or a negative value like -1; a project.yml containing activation_command_timeout: 0 or 0.0; passing float('0') parsed from an env var with a stale/default value.

Common situations: Setting the timeout to 0 to try to 'disable waiting' (unsupported); copying a template with a 0 placeholder and forgetting to fill it in; computing the timeout via a formula that evaluated to 0 (e.g. seconds * missing multiplier).

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/e45453e180d86ad5. Report an issue: GitHub.