chenhg5/cc-connect · error

project %q not found

Error message

project %q not found

What it means

handleSend could not find an engine registered under the requested project name. Deliberate no-fallback guard (HTTP 404): an explicitly named but unknown project is rejected rather than misrouted to another engine.

Source

Thrown at core/api.go:247

		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 {
		if err := engine.SendAudiosToSession(req.SessionKey, req.Audios); err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check the project value against the [[project]] names defined in config.toml (exact match)
  2. List available projects via the API if supported, and fix the typo in the caller
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/api.go:247 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/9da61824c52221eb. Report an issue: GitHub.