multica-ai/multica · error

cannot resolve the state directory for profile

Error message

cannot resolve the state directory for profile %q

What it means

daemonLogSourcePath detected that daemonDirForProfile returned a relative daemon.log path, meaning the home directory could not be resolved for the profile. Because the path is shown to users to open elsewhere, a relative path would resolve against the caller's cwd and is rejected instead.

Solutions

  1. Check the profile name and daemon state directory configuration.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/cmd/multica/cmd_daemon.go:1533 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at server/cmd/multica/cmd_daemon.go:1533

		return "default"
	}
	return profile
}

// daemonLogSourcePath resolves the daemon.log path for a profile —
// ~/.multica/daemon.log for the default profile,
// ~/.multica/profiles/<name>/daemon.log for a named one — and guarantees it is
// absolute, because this path is shown to the user to paste into an editor or
// another shell.
//
// A relative result means daemonDirForProfile could not resolve the home
// directory and swallowed the error, leaving a bare "daemon.log". That is
// reported instead of returned: it would resolve against the caller's cwd and
// name a file with nothing to do with the daemon.
func daemonLogSourcePath(profile string) (string, error) {
	logPath := daemonLogPathForProfile(profile)
	if !filepath.IsAbs(logPath) {
		return "", fmt.Errorf("cannot resolve the state directory for profile %q", profileLabel(profile))
	}
	return logPath, nil
}

func runDaemonLogs(cmd *cobra.Command, _ []string) error {
	if err := requireHumanLocalCommand("daemon logs"); err != nil {
		return err
	}
	profile := resolveProfile(cmd)
	if err := requireKnownProfile(profile); err != nil {
		return err
	}
	logPath, err := daemonLogSourcePath(profile)
	if err != nil {
		return err
	}
	if _, err := os.Stat(logPath); os.IsNotExist(err) {
		return fmt.Errorf("no log file found at %s\nThe daemon may not have been started in background mode", logPath)

View on GitHub (pinned to 2c0912b6ec)