{"record":{"id":"feedf98eb6014e91","repo":"multica-ai/multica","slug":"save-config-w","errorCode":null,"errorMessage":"save config: %w","messagePattern":"save config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_setup.go","lineNumber":161,"sourceCode":"\t\treturn err\n\t}\n\tprofile := resolveProfile(cmd)\n\n\tcfg := cli.CLIConfig{\n\t\tServerURL: defaultCloudServerURL,\n\t\tAppURL:    defaultCloudAppURL,\n\t}\n\n\tok, err := confirmOverwrite(profile, cfg.ServerURL, cfg.AppURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tif err := cli.SaveCLIConfigForProfile(cfg, profile); err != nil {\n\t\treturn fmt.Errorf(\"save config: %w\", err)\n\t}\n\n\tfmt.Fprintln(os.Stderr, \"Configured for Multica Cloud (https://multica.ai).\")\n\tfmt.Fprintf(os.Stderr, \"  server_url: %s\\n\", cfg.ServerURL)\n\tfmt.Fprintf(os.Stderr, \"  app_url:    %s\\n\", cfg.AppURL)\n\tprintConfigLocation(profile)\n\n\t// Authenticate.\n\tfmt.Fprintln(os.Stderr, \"\")\n\tif err := runLogin(cmd, args); err != nil {\n\t\treturn err\n\t}\n\n\tif err := runDaemonAfterSetup(cmd, args); err != nil {\n\t\treturn fmt.Errorf(\"start or restart daemon: %w\", err)\n\t}\n\tfmt.Fprintln(os.Stderr, \"\\n✓ Setup complete! Your machine is now connected to Multica.\")\n","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_setup.go#L143-L179","documentation":"Returned by `multica setup` (cloud flow) when cli.SaveCLIConfigForProfile fails to persist the freshly confirmed cloud config (server_url/app_url pointing at Multica Cloud). It fires only after the user confirmed the overwrite prompt, and before login or daemon start, so no partial auth state is created.","triggerScenarios":"Running `multica setup` and confirming, when the profile config file cannot be written: read-only home, permission mismatch, full disk, or an unwritable config directory.","commonSituations":"First-run on a machine with a locked-down home directory; config directory previously created by root or another user; running inside a container without a writable mount for ~/.config; CI contexts with HOME unset.","solutions":["Read the wrapped error to distinguish permission vs disk-full vs path issues.","Ensure the profile config directory exists and is writable by the current user.","Free disk space or remount the config volume read-write.","Re-run `multica setup` and confirm the overwrite prompt again."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Wrap `multica setup` in the automation harness, on 'save config:' failure check the wrapped message for permission/disk causes, remediate, then re-run setup — it is idempotent (re-prompts overwrite).","preventionTips":["Pre-create the config directory with correct ownership in provisioning scripts.","Ensure HOME is set and writable in containers/CI.","Run setup as the same user that will run the daemon."],"tags":["go","cli","setup","config","filesystem"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}