multica-ai/multica · error

workspace_id is required: use --workspace-id flag, set MULTI

Error message

workspace_id is required: use --workspace-id flag, set MULTICA_WORKSPACE_ID env, or run 'multica config set workspace_id <id>'

What it means

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`.

Source

Thrown at server/cmd/multica/cmd_agent.go:505

	// identity. Never read the user-global CLI config here.
	if inDaemonManagedExecutionContext() {
		return ""
	}
	profile := resolveProfile(cmd)
	cfg, _ := cli.LoadCLIConfigForProfile(profile)
	return cfg.WorkspaceID
}

// requireWorkspaceID resolves the workspace ID and returns an error with
// actionable instructions if it is empty (e.g. user has multiple workspaces
// but no default configured).
func requireWorkspaceID(cmd *cobra.Command) (string, error) {
	id := resolveWorkspaceID(cmd)
	if id == "" {
		if inDaemonManagedExecutionContext() {
			return "", fmt.Errorf("workspace_id is required: MULTICA_WORKSPACE_ID must be set by the daemon in agent execution context (no fallback to user config)")
		}
		return "", fmt.Errorf("workspace_id is required: use --workspace-id flag, set MULTICA_WORKSPACE_ID env, or run 'multica config set workspace_id <id>'")
	}
	return id, nil
}

// ---------------------------------------------------------------------------
// Agent commands
// ---------------------------------------------------------------------------

func runAgentList(cmd *cobra.Command, _ []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}
	if client.WorkspaceID == "" {
		if _, err := requireWorkspaceID(cmd); err != nil {
			return err
		}
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Persist a default: multica config set workspace_id <id>.
  2. Or export MULTICA_WORKSPACE_ID in the shell/script.
  3. Or pass --workspace-id per command when juggling multiple workspaces.
  4. Run `multica workspace list` (or the equivalent) to find the correct ID first.

Example fix

# before
multica issue list  # -> workspace_id is required: use --workspace-id ...

# after
multica config set workspace_id ws_123
multica issue list
Defensive patterns

Strategy: validation

Validate before calling

id := resolveWorkspaceID(cmd)
if id == "" {
    return fmt.Errorf("workspace_id is required: use --workspace-id flag, set MULTICA_WORKSPACE_ID env, or run 'multica config set workspace_id <id>'")
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/5f3eebbc5045c456. Report an issue: GitHub.