multica-ai/multica · error

resolve absolute workspaces root: %w

Error message

resolve absolute workspaces root: %w

What it means

The tail of ResolveWorkspacesRoot: after a root value is determined (from env, override, or $HOME), filepath.Abs(root) failed. Abs only fails when os.Getwd fails and the path is relative — i.e. the process's working directory was deleted or is unreadable, and the configured root was relative rather than absolute.

Source

Thrown at server/internal/daemon/config.go:631

func ResolveWorkspacesRoot(profile, override string) (string, error) {
	root := strings.TrimSpace(os.Getenv("MULTICA_WORKSPACES_ROOT"))
	if override != "" {
		root = override
	}
	if root == "" {
		home, err := os.UserHomeDir()
		if err != nil {
			return "", fmt.Errorf("resolve home directory: %w (set MULTICA_WORKSPACES_ROOT to override)", err)
		}
		if profile != "" {
			root = filepath.Join(home, "multica_workspaces_"+profile)
		} else {
			root = filepath.Join(home, "multica_workspaces")
		}
	}
	abs, err := filepath.Abs(root)
	if err != nil {
		return "", fmt.Errorf("resolve absolute workspaces root: %w", err)
	}
	return abs, nil
}

// ArtifactPatternsFromEnv returns the configured artifact patternSet — the
// same list the GC loop consults when it runs the artifact-only cleanup. The
// disk-usage CLI uses this to make sure the "artifact size" it reports
// matches what the GC would actually reclaim.
func ArtifactPatternsFromEnv() []string {
	return patternsFromEnv("MULTICA_GC_ARTIFACT_PATTERNS", DefaultGCArtifactPatterns)
}

// patternsFromEnv reads a comma-separated list from env. Patterns containing
// path separators are silently dropped — the GC artifact cleanup only matches
// directory basenames, never paths, so a pattern like "foo/bar" is meaningless
// and accepting it would just be a footgun.
func patternsFromEnv(name string, defaults []string) []string {
	raw := strings.TrimSpace(os.Getenv(name))

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Set MULTICA_WORKSPACES_ROOT to an absolute path (/data/workspaces)
  2. Ensure the daemon's working directory exists for the whole process lifetime
  3. If a launcher script cds into a temp dir, launch the daemon from a stable directory instead

Example fix

# before
export MULTICA_WORKSPACES_ROOT=workspaces # relative
# after
export MULTICA_WORKSPACES_ROOT=/var/lib/multica/workspaces # absolute
Defensive patterns

Strategy: validation

Validate before calling

// Reject relative roots before use.
if !filepath.IsAbs(root) {
    abs, err := filepath.Abs(root) // can fail if cwd is gone
    if err != nil {
        return fmt.Errorf("relative workspaces root %q and cwd unavailable: use an absolute path", root)
    }
    root = abs
}

Try / catch

Catch and re-prompt with the requirement 'provide an absolute MULTICA_WORKSPACES_ROOT'; not retryable within the same process.

Prevention

When it happens

Trigger: Setting MULTICA_WORKSPACES_ROOT to a relative path (e.g. 'workspaces') while the daemon's cwd has been removed (common in container setups that rm the workdir, or when launched from a deleted temp dir).

Common situations: Containers where WORKDIR is removed at runtime, relative paths in config combined with unusual launch contexts, or chdir-based test harnesses.

Related errors


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