crewAIInc/crewAI · warning · SystemExit

Error: Unknown or readonly configuration key '{key}'

Error message

Error: Unknown or readonly configuration key '{key}'

What it means

Settings validation in the CLI's settings manager: `crewai config set <key> <value>` (set_value) rejects keys that either don't exist on the Settings pydantic model (hasattr check fails) or are in READONLY_SETTINGS_KEYS/HIDDEN_SETTINGS_KEYS. The CLI prints the error in bold red, lists the valid, non-readonly keys, and exits 1 — no setting is modified.

Source

Thrown at lib/cli/src/crewai_cli/settings/main.py:91

        )

        console.print(table)

    def set(self, key: str, value: str) -> None:
        """Set a CLI configuration parameter."""

        readonly_settings = READONLY_SETTINGS_KEYS + HIDDEN_SETTINGS_KEYS

        if not hasattr(self.settings, key) or key in readonly_settings:
            console.print(
                f"Error: Unknown or readonly configuration key '{key}'",
                style="bold red",
            )
            console.print("Available keys:", style="yellow")
            for field_name in Settings.model_fields:
                if field_name not in readonly_settings:
                    console.print(f"  - {field_name}", style="yellow")
            raise SystemExit(1)

        setattr(self.settings, key, value)
        self.settings.dump()

        console.print(f"Successfully set '{key}' to '{value}'", style="bold green")

    def reset_all_settings(self) -> None:
        """Reset all CLI configuration parameters to default values."""
        self.settings.reset()
        console.print(
            "Successfully reset all configuration parameters to default values. It is recommended to run [bold yellow]'crewai login'[/bold yellow] to re-authenticate.",
            style="bold green",
        )

View on GitHub (pinned to 754d7323be)

Solutions

  1. Copy a key directly from the 'Available keys' list printed by the error itself.
  2. Check spelling, casing, and hyphens vs underscores — keys must match Settings model field names exactly.
  3. If the key is readonly on purpose (auth/session data), use the corresponding command (e.g. `crewai login`) instead of config set.
  4. If you expected the key to exist, upgrade/downgrade to the crewai CLI version whose Settings model includes it.

Example fix

# before
$ crewai config set telemetry_enbaled false   # typo
# Error: Unknown or readonly configuration key 'telemetry_enbaled'

# after
$ crewai config set telemetry_enabled false   # exact key from the printed list
Defensive patterns

Strategy: validation

Validate before calling

from crewai_cli.settings import Settings  # adjust import to installed version

readonly = set(READONLY_SETTINGS_KEYS) | set(HIDDEN_SETTINGS_KEYS)  # from settings module
valid = {k for k in Settings.model_fields if k not in readonly}

def assert_settable(key: str) -> None:
    if key not in valid:
        raise SystemExit(f"{key!r} is unknown/readonly; valid: {sorted(valid)}")

Type guard

def is_settable_setting(key: str) -> bool:
    return key in Settings.model_fields and key not in (
        set(READONLY_SETTINGS_KEYS) | set(HIDDEN_SETTINGS_KEYS)
    )

Prevention

When it happens

Trigger: Calling set with a misspelled key; using a key that exists but is readonly/hidden by policy (e.g. auth/session-related fields); keys from an older/newer crewai version than the docs you followed; wrong casing (keys are exact field names).

Common situations: Following outdated docs or blog posts naming settings that were renamed; scripts programmatically setting config keys after an upgrade; attempting to manually set keys the CLI manages internally (login tokens).

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/34913c6d8eda16fe. Report an issue: GitHub.