chenhg5/cc-connect · error

project is required (multiple projects configured)

Error message

project is required (multiple projects configured)

What it means

handleSend on the HTTP API received no project name while more than one engine/project is configured, so it cannot decide which project's engine should deliver the message. This is a deliberate refusal to guess rather than a routing bug.

Source

Thrown at core/api.go:244

	var engine *Engine
	var ok bool
	if req.Project != "" {
		engine, ok = s.engines[req.Project]
	} else if len(s.engines) == 1 {
		// No project specified and only one engine: use it by default.
		// Do NOT silently fall back when a non-empty project name is unknown —
		// that misroutes the message to the wrong engine. Mirrors the resolve
		// pattern in webhook.go and handleCronAdd.
		for _, e := range s.engines {
			engine = e
			ok = true
		}
	}
	s.mu.RUnlock()

	if !ok {
		if req.Project == "" {
			http.Error(w, "project is required (multiple projects configured)", http.StatusBadRequest)
			return
		}
		http.Error(w, fmt.Sprintf("project %q not found", req.Project), http.StatusNotFound)
		return
	}

	workDir := req.WorkDir
	if workDir == "" {
		workDir = req.CWD
	}
	if req.Message != "" || len(req.Images) > 0 || len(req.Files) > 0 {
		if err := engine.SendToSessionWithOptions(req.SessionKey, req.Message, req.Images, req.Files, SendOptions{WorkDir: workDir, AtUsers: req.AtUsers, AtAll: req.AtAll}); err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
	}

	if len(req.Audios) > 0 {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Include the project field in the /api/send request body naming the target project
  2. Reduce to a single configured project if no routing is needed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/api.go:244 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/51c3766d4e11b7f8. Report an issue: GitHub.