multica-ai/multica · error · errTaskPrepareTimeout

after

Error message

%w after %s

What it means

Wraps the prepare-phase timeout sentinel (errTaskPrepareTimeout) with elapsed time: the deferred handler in runTask collapses every prepare failure caused by the context deadline into this form when the task's environment could not be prepared within effectiveTaskPrepareTimeout. Indicates a slow/hung prepare (skill downloads, worktree, exec env), after which the task is re-queueable.

Solutions

  1. Inspect the wrapped error and the timing context for the failing operation.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at server/internal/daemon/daemon.go:6099 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/1264ee89da5608d2. Report an issue: GitHub.

Appendix: source

Thrown at server/internal/daemon/daemon.go:6099

	// path that can leak operations into an unrelated workspace when
	// multiple workspaces share a host.
	if task.WorkspaceID == "" {
		return TaskResult{}, fmt.Errorf("refusing to spawn agent: task has no workspace_id (task_id=%s)", task.ID)
	}

	prepareTimeout := d.effectiveTaskPrepareTimeout()
	prepareCtx, cancelPrepare := context.WithTimeoutCause(ctx, prepareTimeout, errTaskPrepareTimeout)
	prepareComplete := false
	defer func() {
		cancelPrepare()
		if prepareComplete || returnErr == nil || !errors.Is(context.Cause(prepareCtx), errTaskPrepareTimeout) {
			return
		}
		// Collapse every deadline shape (context deadline, HTTP cancellation,
		// or the explicit waitForExecutionEnvironment cause) into one sentinel
		// that handleTask can classify as a retryable platform timeout.
		taskResult = TaskResult{}
		returnErr = fmt.Errorf("%w after %s", errTaskPrepareTimeout, prepareTimeout)
	}()

	// task.Repos is the authoritative repo list for this task — when the
	// claimed task belongs to a project with github_repo resources the server
	// has already narrowed it to project repos only. Make sure those URLs are
	// in the per-workspace allowlist and the local cache, otherwise
	// `multica repo checkout` would reject project-only URLs that aren't also
	// bound at the workspace level.
	d.registerTaskRepos(task.WorkspaceID, task.ID, task.Repos)
	defer d.clearTaskRepoRefs(task.WorkspaceID, task.ID)

	entry, ok := d.agents()[provider]
	// A custom runtime profile (MUL-3284) overrides the executable path: the
	// runtime's protocol_family is the provider (so agent.New still selects
	// the right backend), but the actual binary on PATH is the profile's
	// command_name, resolved at registration time and keyed by RuntimeID here.
	// Critically, a custom runtime can live on a host that has NO built-in
	// agent of the same provider installed, so when the runtime is custom we

View on GitHub (pinned to 2c0912b6ec)