multica-ai/multica · error

write cursor workspace trust

Error message

write cursor workspace trust: %w

What it means

Wraps the os.WriteFile failure when writing the workspace-trust file into the Cursor project data directory. Without it Cursor may not trust the managed workspace, so preparation fails with the filesystem cause preserved.

Solutions

  1. Check permissions to write the cursor workspace trust file.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/internal/daemon/execenv/cursor_mcp.go:108 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/b0a7ab93cce554f6. Report an issue: GitHub.

Appendix: source

Thrown at server/internal/daemon/execenv/cursor_mcp.go:108

		return "", err
	}
	approvalData, err := json.MarshalIndent(approvals, "", "  ")
	if err != nil {
		return "", fmt.Errorf("marshal cursor mcp approvals: %w", err)
	}
	if err := os.WriteFile(filepath.Join(projectDataDir, "mcp-approvals.json"), approvalData, 0o600); err != nil {
		return "", fmt.Errorf("write cursor mcp approvals: %w", err)
	}
	trustData, err := json.MarshalIndent(map[string]string{
		"trustedAt":     "1970-01-01T00:00:00Z",
		"workspacePath": projectRoot,
		"trustMethod":   "multica-managed",
	}, "", "  ")
	if err != nil {
		return "", fmt.Errorf("marshal cursor workspace trust: %w", err)
	}
	if err := os.WriteFile(filepath.Join(projectDataDir, cursorWorkspaceTrustedFile), trustData, 0o600); err != nil {
		return "", fmt.Errorf("write cursor workspace trust: %w", err)
	}
	if strings.TrimSpace(mcpAuthSource) != "" {
		if err := seedCursorMcpAuthFile(projectDataDir, mcpAuthSource); err != nil {
			return "", err
		}
	}

	return cursorDataDir, nil
}

func seedCursorMcpAuthFile(projectDataDir, source string) error {
	sourcePath, err := resolveCursorMcpAuthSource(source)
	if err != nil {
		return err
	}
	target := filepath.Join(projectDataDir, cursorMcpAuthFile)
	if err := os.Symlink(sourcePath, target); err == nil {
		return nil

View on GitHub (pinned to 2c0912b6ec)