chenhg5/cc-connect · error
err.Error()
Error message
err.Error()
What it means
`ws.resolveEngine(req.Project)` failed — the requested project could not be mapped to a running engine — and its error text is returned verbatim with 400. This typically means the project name in the payload doesn't match any configured/registered project.
Source
Thrown at core/webhook.go:118
return
}
if req.SessionKey == "" {
http.Error(w, "session_key is required", http.StatusBadRequest)
return
}
if req.Prompt == "" && req.Exec == "" {
http.Error(w, "either prompt or exec is required", http.StatusBadRequest)
return
}
if req.Prompt != "" && req.Exec != "" {
http.Error(w, "prompt and exec are mutually exclusive", http.StatusBadRequest)
return
}
engine, err := ws.resolveEngine(req.Project)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
eventName := req.Event
if eventName == "" {
eventName = "webhook"
}
slog.Info("webhook: received",
"event", eventName,
"project", req.Project,
"session_key", req.SessionKey,
"has_prompt", req.Prompt != "",
"has_exec", req.Exec != "",
)
if req.Exec != "" {
go ws.executeShell(engine, req, eventName)View on GitHub (pinned to 4000b2338a)
Solutions
- Use the exact project name from config.toml / engine registration (check case).
- Omit the project field if you run a single project and no default is required.
- Verify the engine for that project started successfully before sending webhooks.
- Inspect resolveEngine to confirm how project names are keyed and match accordingly.
Example fix
// before
{"session_key":"s1","prompt":"hi","project":"myapp"} // config has [projects.my-app]
// after
{"session_key":"s1","prompt":"hi","project":"my-app"} Defensive patterns
Strategy: validation
Validate before calling
var knownProjects = map[string]bool{"my-app": true}
func checkProject(p string) error {
if p != "" && !knownProjects[p] { return fmt.Errorf("unknown project %q", p) }
return nil
} Type guard
func isProjectNotFound(resp *http.Response) bool {
if resp == nil || resp.StatusCode != 400 { return false }
b, _ := io.ReadAll(resp.Body)
return strings.Contains(strings.ToLower(string(b)), "project")
} Try / catch
resp, err := http.Post(url, "application/json", bytes.NewReader(payload))
if err == nil && resp.StatusCode == 400 {
b, _ := io.ReadAll(resp.Body)
return fmt.Errorf("resolveEngine rejected project: %s", b) // body carries the reason
} Prevention
- Copy project names from config.toml verbatim, not from memory
- Keep a client-side list of valid project names and validate before sending
- Confirm the engine for the project is running before dispatching hooks
- Watch for case-sensitive mismatches between payload and config
When it happens
Trigger: req.Project set to a name not present in the webhook server's project registry; empty project when no default project is configured; project service not yet started when the request arrives.
Common situations: Typo in the project name (case-sensitive mismatch); config.toml lists a project the server doesn't register; sending project for a single-project deployment that ignores it.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- cloud_web: public_url is required when register_url is set f
- invalid JSON:
- session_key is required
- either prompt or exec is required
- prompt and exec are mutually exclusive
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/d407ce7bcc251ab6.
Report an issue: GitHub.