{"record":{"id":"b93be5559ee0b149","repo":"multica-ai/multica","slug":"not-authenticated-run-s-first","errorCode":null,"errorMessage":"not authenticated: run %s first","messagePattern":"not authenticated: run (.+?) first","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/daemon.go","lineNumber":2052,"sourceCode":"\t\td.logger.Warn(\"failed to deregister runtimes on shutdown\", \"error\", err)\n\t} else {\n\t\td.logger.Info(\"deregistered runtimes\", \"count\", len(runtimeIDs))\n\t}\n}\n\n// resolveAuth loads the auth token from the CLI config for the active profile.\nfunc (d *Daemon) resolveAuth() error {\n\tcfg, err := cli.LoadCLIConfigForProfile(d.cfg.Profile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"load CLI config: %w\", err)\n\t}\n\tif cfg.Token == \"\" {\n\t\tloginHint := \"'multica login'\"\n\t\tif d.cfg.Profile != \"\" {\n\t\t\tloginHint = fmt.Sprintf(\"'multica login --profile %s'\", d.cfg.Profile)\n\t\t}\n\t\td.logger.Warn(\"not authenticated — run \" + loginHint + \" to authenticate, then restart the daemon\")\n\t\treturn fmt.Errorf(\"not authenticated: run %s first\", loginHint)\n\t}\n\td.client.SetToken(cfg.Token)\n\td.logger.Info(\"authenticated\")\n\td.logger.Debug(\"auth token loaded\", \"profile\", d.cfg.Profile, \"token_len\", len(cfg.Token))\n\treturn nil\n}\n\n// allRuntimeIDs returns all runtime IDs across all watched workspaces.\nfunc (d *Daemon) allRuntimeIDs() []string {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\tvar ids []string\n\tfor _, ws := range d.workspaces {\n\t\tids = append(ids, ws.runtimeIDs...)\n\t}\n\treturn ids\n}\n","sourceCodeStart":2034,"sourceCodeEnd":2070,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/daemon.go#L2034-L2070","documentation":"Daemon.resolveAuth loads the CLI config for the active profile and found an empty token: the user never logged in for that profile (or the config file has no token). The error tells you the exact command to run — plain 'multica login' or 'multica login --profile <name>' — and the daemon also logs a warning at startup. The daemon refuses to operate unauthenticated.","triggerScenarios":"Starting the daemon before ever logging in, or starting it with --profile work when only the default profile has a token. Also after wiping ~/.multica (or wherever the CLI config lives) or logging out.","commonSituations":"Fresh installs, switching to a new --profile without logging in for it, CI/container images missing the auth config file, and users who logged out or rotated configs.","solutions":["Run 'multica login' (or 'multica login --profile <profile>') in the same user account the daemon runs as","Restart the daemon after login — the token is read once at startup","In containers/CI, mount or copy the CLI config with the token instead of interactive login"],"exampleFix":"# before\n$ multica --profile work daemon\nERROR: not authenticated: run 'multica login --profile work' first\n\n# after\n$ multica login --profile work\n$ multica --profile work daemon","handlingStrategy":"validation","validationCode":"// Pre-flight auth check before starting long-running work.\ncfg, err := cli.LoadCLIConfigForProfile(profile)\nif err != nil {\n    return fmt.Errorf(\"load CLI config: %w\", err)\n}\nif cfg.Token == \"\" {\n    if profile != \"\" {\n        return fmt.Errorf(\"run 'multica login --profile %s' first\", profile)\n    }\n    return fmt.Errorf(\"run 'multica login' first\")\n}","typeGuard":null,"tryCatchPattern":"Detect via strings.HasPrefix(err.Error(), \"not authenticated:\") (or a typed sentinel) at daemon startup and route to a login prompt instead of crash-looping; the daemon will not recover without user action.","preventionTips":["Log in per profile immediately after creating it","In automation, provision the CLI config file with the token before daemon start","Add a startup health check that fails fast on missing tokens"],"tags":["daemon","auth","login","startup","profile"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}