multica-ai/multica · error

MULTICA_DAEMON_PORT not set (this command is intended to be

Error message

MULTICA_DAEMON_PORT not set (this command is intended to be run by an agent inside a daemon task)

What it means

runRepoCheckout refuses to run when the MULTICA_DAEMON_PORT environment variable is empty. Unlike the other repo subcommands it does not talk to the main API; it POSTs to a local daemon at http://127.0.0.1:$PORT/repo/checkout, and that port is only injected when the multica daemon spawns the command inside an agent task.

Source

Thrown at server/cmd/multica/cmd_repo.go:340

	}
	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, result)
	}
	rows := make([][]string, 0, len(removed))
	for _, repo := range removed {
		rows = append(rows, []string{repo.URL, repo.Description})
	}
	cli.PrintTable(os.Stdout, []string{"REMOVED URL", "DESCRIPTION"}, rows)
	return nil
}

func runRepoCheckout(cmd *cobra.Command, args []string) error {
	repoURL := args[0]

	daemonPort := os.Getenv("MULTICA_DAEMON_PORT")
	if daemonPort == "" {
		return fmt.Errorf("MULTICA_DAEMON_PORT not set (this command is intended to be run by an agent inside a daemon task)")
	}

	workspaceID := os.Getenv("MULTICA_WORKSPACE_ID")
	agentName := os.Getenv("MULTICA_AGENT_NAME")
	taskID := os.Getenv("MULTICA_TASK_ID")

	// Use current working directory as the checkout target.
	workDir, err := os.Getwd()
	if err != nil {
		return fmt.Errorf("get working directory: %w", err)
	}

	reqBody := map[string]any{
		"url":           repoURL,
		"workspace_id":  workspaceID,
		"workdir":       workDir,
		"ref":           repoCheckoutRef,
		"agent_name":    agentName,

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Run the command from inside a daemon task (the intended context) — e.g. instruct the agent to run it, so the daemon sets MULTICA_DAEMON_PORT.
  2. For manual testing, set the variable to the actual daemon port: query the daemon process/config for its listen port, then MULTICA_DAEMON_PORT=<port> multica repo checkout <url>.
  3. If wrapping in a subprocess, forward the environment: exec.Command with os.Environ(), or docker exec -e MULTICA_DAEMON_PORT.

Example fix

# before (plain shell)
multica repo checkout https://github.com/acme/api
# error: MULTICA_DAEMON_PORT not set

# after (manual test)
MULTICA_DAEMON_PORT=8123 multica repo checkout https://github.com/acme/api
Defensive patterns

Strategy: validation

Validate before calling

port := os.Getenv("MULTICA_DAEMON_PORT")
if port == "" {
	return fmt.Errorf("not inside a daemon task; set MULTICA_DAEMON_PORT or run via the daemon")
}

Prevention

When it happens

Trigger: Running `multica repo checkout <url>` manually from a plain shell (not from within a daemon-spawned agent task), so MULTICA_DAEMON_PORT was never set; or a task runner that clears the environment before executing the command.

Common situations: A developer trying to test checkout locally; an agent whose execution environment is sanitized (env -i, docker exec without -e, systemd service without PassEnvironment), dropping daemon-injected vars.

Related errors


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