Hmbown/CodeWhale · error

--project requires a workspace config

Error message

--project requires a workspace config ({} is the user-global document)

What it means

Config commands accept a `--project` (project bundle) scope flag, but it is only valid when the store's path points at a workspace-scoped config document. When the active store is the user-global document, the flag is refused and the offending path is interpolated into the message.

Solutions

  1. Run the command from inside a workspace directory so a workspace-scoped config is used
  2. Drop `--project` to operate on the user-global document
  3. Point the invocation at a workspace config path explicitly if supported

Example fix

// before
cd ~ && codewhale config --project set model gpt-5
// after
cd /path/to/workspace && codewhale config --project set model gpt-5
Defensive patterns

Strategy: validation

Validate before calling

if [ "$use_project" = true ] && ! git rev-parse --show-toplevel >/dev/null 2>&1; then echo "--project requires a workspace"; exit 1; fi

Try / catch

try { runConfigCommand(['--project', ...args]) } catch (e) { if (String(e).includes('user-global document')) { runConfigCommand(args); } else { throw e; } }

Prevention

When it happens

Trigger: Running `codewhale config --project <subcommand>` from a context (e.g. outside a workspace, or with an explicit global config path) where the resolved store path is the user-global config.toml.

Common situations: Running config --project in $HOME or a non-workspace directory; explicitly passing the global config path; scripts assuming a workspace root that isn't detected.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/ba851b15f52f88da. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/lib.rs:4474

                "config.toml at {} no longer contains api_key entries for migrated providers.",
                store.path().display()
            );
        }
    }
    for w in warnings {
        eprintln!("warning: {w}");
    }
    Ok(())
}

fn run_config_command(
    store: &mut ConfigStore,
    command: ConfigCommand,
    project_bundle_scope: bool,
    per_run_overrides: &[String],
) -> Result<()> {
    if project_bundle_scope && !codewhale_config::config_path_is_workspace_scoped(store.path()) {
        bail!(
            "--project requires a workspace config ({} is the user-global document)",
            store.path().display()
        );
    }
    // A per-run overlay must never leak into the file: commands that write
    // the store refuse it outright instead of saving a merged document.
    if !per_run_overrides.is_empty()
        && matches!(
            command,
            ConfigCommand::Set { .. }
                | ConfigCommand::Unset { .. }
                | ConfigCommand::Import(_)
                | ConfigCommand::Telemetry {
                    accept_notice: Some(_)
                }
        )
    {
        bail!(

View on GitHub (pinned to 73e0f67d83)