{"record":{"id":"5f3eebbc5045c456","repo":"multica-ai/multica","slug":"workspace-id-is-required-use-workspace-id-flag","errorCode":null,"errorMessage":"workspace_id is required: use --workspace-id flag, set MULTICA_WORKSPACE_ID env, or run 'multica config set workspace_id <id>'","messagePattern":"workspace_id is required: use --workspace-id flag, set MULTICA_WORKSPACE_ID env, or run 'multica config set workspace_id <id>'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":505,"sourceCode":"\t// identity. Never read the user-global CLI config here.\n\tif inDaemonManagedExecutionContext() {\n\t\treturn \"\"\n\t}\n\tprofile := resolveProfile(cmd)\n\tcfg, _ := cli.LoadCLIConfigForProfile(profile)\n\treturn cfg.WorkspaceID\n}\n\n// requireWorkspaceID resolves the workspace ID and returns an error with\n// actionable instructions if it is empty (e.g. user has multiple workspaces\n// but no default configured).\nfunc requireWorkspaceID(cmd *cobra.Command) (string, error) {\n\tid := resolveWorkspaceID(cmd)\n\tif id == \"\" {\n\t\tif inDaemonManagedExecutionContext() {\n\t\t\treturn \"\", fmt.Errorf(\"workspace_id is required: MULTICA_WORKSPACE_ID must be set by the daemon in agent execution context (no fallback to user config)\")\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"workspace_id is required: use --workspace-id flag, set MULTICA_WORKSPACE_ID env, or run 'multica config set workspace_id <id>'\")\n\t}\n\treturn id, nil\n}\n\n// ---------------------------------------------------------------------------\n// Agent commands\n// ---------------------------------------------------------------------------\n\nfunc runAgentList(cmd *cobra.Command, _ []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif client.WorkspaceID == \"\" {\n\t\tif _, err := requireWorkspaceID(cmd); err != nil {\n\t\t\treturn err\n\t\t}\n\t}","sourceCodeStart":487,"sourceCodeEnd":523,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L487-L523","documentation":"The human-context counterpart: requireWorkspaceID found no workspace ID and no daemon context exists, so the error lists the three supported remedies — the --workspace-id flag, the MULTICA_WORKSPACE_ID env var, or persisting a default via `multica config set workspace_id`.","triggerScenarios":"A human user with multiple workspaces and no default configured runs a workspace-scoped command; a fresh install with one flag/env/config source set but the workspace omitted; config written to a different profile than the one in use.","commonSituations":"Onboarding after being added to a second workspace (no obvious default); scripts that set server and token but not workspace; --profile flag pointing at an empty profile.","solutions":["Persist a default: multica config set workspace_id <id>.","Or export MULTICA_WORKSPACE_ID in the shell/script.","Or pass --workspace-id per command when juggling multiple workspaces.","Run `multica workspace list` (or the equivalent) to find the correct ID first."],"exampleFix":"# before\nmultica issue list  # -> workspace_id is required: use --workspace-id ...\n\n# after\nmultica config set workspace_id ws_123\nmultica issue list","handlingStrategy":"validation","validationCode":"id := resolveWorkspaceID(cmd)\nif id == \"\" {\n    return fmt.Errorf(\"workspace_id is required: use --workspace-id flag, set MULTICA_WORKSPACE_ID env, or run 'multica config set workspace_id <id>'\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set a default workspace right after onboarding: multica config set workspace_id <id>.","Scripts that span workspaces should pass --workspace-id explicitly per invocation.","Check --profile when config seems set but not picked up."],"tags":["go","cli","configuration","workspaces"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}