{"record":{"id":"3b6aef8e1b17e8e0","repo":"multica-ai/multica","slug":"server-url-not-set-use-server-url-flag-multica","errorCode":null,"errorMessage":"server URL not set: use --server-url flag, MULTICA_SERVER_URL env, or 'multica config set server_url <url>'","messagePattern":"server URL not set: use --server-url flag, MULTICA_SERVER_URL env, or 'multica config set server_url <url>'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":273,"sourceCode":"\ttaskContext := inDaemonManagedExecutionContext()\n\ttoken := resolveToken(cmd)\n\tif taskContext && !strings.HasPrefix(token, \"mat_\") {\n\t\t// When the ONLY daemon signal is a workdir marker (no MULTICA_AGENT_ID /\n\t\t// MULTICA_TASK_ID / MULTICA_DAEMON_PORT), the likeliest cause outside a\n\t\t// real task is a leftover marker from a crashed daemon task in a\n\t\t// local_directory. Name the exact file so a normal user can recover\n\t\t// instead of hitting an opaque \"requires mat_ token\" error. Shares its\n\t\t// wording with requireHumanLocalCommand: same cause, same remedy.\n\t\tif markerPath := leftoverDaemonTaskMarkerPath(); markerPath != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"agent execution context requires MULTICA_TOKEN to be a task-scoped mat_ token%s\", leftoverMarkerSuffix(markerPath))\n\t\t}\n\t\treturn nil, fmt.Errorf(\"agent execution context requires MULTICA_TOKEN to be a task-scoped mat_ token%s\", daemonPortOnlyContextHint())\n\t}\n\n\tserverURL := resolveServerURL(cmd)\n\tworkspaceID := resolveWorkspaceID(cmd)\n\tif serverURL == \"\" {\n\t\treturn nil, fmt.Errorf(\"server URL not set: use --server-url flag, MULTICA_SERVER_URL env, or 'multica config set server_url <url>'\")\n\t}\n\n\tclient := cli.NewAPIClient(serverURL, workspaceID, token)\n\t// When running inside a daemon task, attribute actions to the agent.\n\tif agentID := os.Getenv(\"MULTICA_AGENT_ID\"); agentID != \"\" {\n\t\tclient.AgentID = agentID\n\t}\n\tif taskID := os.Getenv(\"MULTICA_TASK_ID\"); taskID != \"\" {\n\t\tclient.TaskID = taskID\n\t}\n\treturn client, nil\n}\n\nconst (\n\tdefaultCloudServerURL = \"https://api.multica.ai\"\n\tdefaultCloudAppURL    = \"https://multica.ai\"\n)\n","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L255-L291","documentation":"newAPIClient could not determine the Multica server URL: the --server-url flag is unset, MULTICA_SERVER_URL is empty, and no server_url was persisted via `multica config set`. The message lists all three remedies explicitly.","triggerScenarios":"Fresh install where no config was ever written; a CI/container environment that sets only the token and workspace but not the URL; a profile whose config file lacks server_url; the MULTICA_SERVER_URL var misspelled.","commonSituations":"First run after install; switching machines or profiles; scripts that assume config carries over; running inside a daemon task where the task-local config root is a fresh, empty directory.","solutions":["Set the env var for one-off use: MULTICA_SERVER_URL=https://app.multica.dev multica agent list.","Persist it: multica config set server_url https://app.multica.dev.","Pass --server-url on the command when mixing multiple environments.","If in a daemon task, verify the task-local config root is populated rather than an empty injected directory."],"exampleFix":"# before\nmultica agent list  # -> server URL not set\n\n# after\nmultica config set server_url https://app.multica.dev\nmultica agent list","handlingStrategy":"validation","validationCode":"serverURL := resolveServerURL(cmd)\nif serverURL == \"\" {\n    return fmt.Errorf(\"server URL not set: use --server-url flag, MULTICA_SERVER_URL env, or 'multica config set server_url <url>'\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `multica config set server_url <url>` as part of workstation setup.","In scripts and containers, always export MULTICA_SERVER_URL explicitly.","Add a preflight check that errors with the three supported remedies before doing real work."],"tags":["go","cli","configuration","environment"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}