{"record":{"id":"989fc8656739352a","repo":"aaif-goose/goose","slug":"goose-server-secret-key-must-be-set-to-start-goo","errorCode":null,"errorMessage":"GOOSE_SERVER__SECRET_KEY must be set to start `goose serve`; pass --dangerously-unauthenticated to run without ACP authentication","messagePattern":"GOOSE_SERVER__SECRET_KEY must be set to start `goose serve`; pass --dangerously-unauthenticated to run without ACP authentication","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/cli.rs","lineNumber":1452,"sourceCode":"            SourceRoot::read_only(path)\n        })\n        .collect();\n\n    let server = Arc::new(AcpServer::new(AcpServerFactoryConfig {\n        builtins,\n        data_dir: Paths::data_dir(),\n        config_dir: Paths::config_dir(),\n        goose_platform: platform.into(),\n        additional_source_roots,\n        enable_scheduler,\n    }));\n    let env_secret = std::env::var(GOOSE_SERVER_SECRET_KEY_ENV)\n        .ok()\n        .map(|secret| secret.trim().to_string())\n        .filter(|secret| !secret.is_empty());\n    let require_token = env_secret.is_some();\n    if !require_token && !dangerously_unauthenticated {\n        anyhow::bail!(\n            \"{GOOSE_SERVER_SECRET_KEY_ENV} must be set to start `goose serve`; pass --dangerously-unauthenticated to run without ACP authentication\"\n        );\n    }\n    if dangerously_unauthenticated && !require_token {\n        warn!(\n            \"{GOOSE_SERVER_SECRET_KEY_ENV} is not set and --dangerously-unauthenticated was passed; the ACP endpoint will accept unauthenticated connections\"\n        );\n    }\n    let additional_allowed_origins = allowed_origins\n        .into_iter()\n        .map(|origin| {\n            let origin = origin.trim();\n            if origin.is_empty() || origin == \"*\" {\n                anyhow::bail!(\"--allowed-origin must be a non-wildcard Origin value\");\n            }\n            HeaderValue::from_str(origin).map_err(|error| {\n                anyhow::anyhow!(\"invalid --allowed-origin value `{origin}`: {error}\")\n            })","sourceCodeStart":1434,"sourceCodeEnd":1470,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/cli.rs#L1434-L1470","documentation":"anyhow bail from the 'goose serve' startup (crates/goose-cli/src/cli.rs). The ACP server requires authentication by default: it reads GOOSE_SERVER__SECRET_KEY from the environment, trims it, and treats empty as unset. If the key is absent/empty and --dangerously-unauthenticated was not passed, startup refuses with this message.","triggerScenarios":"Running 'goose serve' (or the desktop platform variant) with GOOSE_SERVER__SECRET_KEY unset, set to an empty string, or containing only whitespace, without passing --dangerously-unauthenticated.","commonSituations":"First-time serve usage; CI/container where the env var was not injected; double-underscore typo (GOOSE_SERVER_SECRET_KEY instead of GOOSE_SERVER__SECRET_KEY); a .env file not loaded into the actual environment.","solutions":["Set the env var to a strong random value: export GOOSE_SERVER__SECRET_KEY=\"$(openssl rand -hex 32)\"","Double-check the exact name — it uses double underscores: GOOSE_SERVER__SECRET_KEY","Ensure the value is non-empty after trimming (no quotes-only or whitespace-only exports)","For local, trusted experimentation only: goose serve --dangerously-unauthenticated (it warns and accepts unauthenticated connections)"],"exampleFix":"# before\ngoose serve\n\n# after\nexport GOOSE_SERVER__SECRET_KEY=\"$(openssl rand -hex 32)\"\ngoose serve","handlingStrategy":"validation","validationCode":"import os\nkey = os.environ.get(\"GOOSE_SERVER__SECRET_KEY\", \"\").strip()\nif not key:\n    raise SystemExit(\"set GOOSE_SERVER__SECRET_KEY (note double underscore) before `goose serve`\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Export a generated secret in the serve environment: GOOSE_SERVER__SECRET_KEY=$(openssl rand -hex 32)","Note the double underscores in the variable name","Inject it via secret manager/env file in containers — never commit it","Use --dangerously-unauthenticated only on an isolated loopback machine"],"tags":["goose","serve","authentication","environment","security"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}