chenhg5/cc-connect · error
url is required for type=http
Error message
url is required for type=http
What it means
validateHookConfig requires a URL for hooks whose handler type is "http". An HTTP hook POSTs event data to the configured endpoint; an empty URL leaves it with no target, so the configuration is rejected.
Source
Thrown at core/hooks.go:118
shell: shell,
shellFlag: shellFlag,
shellProfile: shellProfile,
client: &http.Client{},
}
}
func validateHookConfig(h HookConfig) error {
if h.Event == "" {
return fmt.Errorf("event is required")
}
switch HookHandlerType(h.Type) {
case HookHandlerCommand:
if h.Command == "" {
return fmt.Errorf("command is required for type=command")
}
case HookHandlerHTTP:
if h.URL == "" {
return fmt.Errorf("url is required for type=http")
}
if !strings.HasPrefix(h.URL, "http://") && !strings.HasPrefix(h.URL, "https://") {
return fmt.Errorf("url must start with http:// or https://")
}
default:
return fmt.Errorf("unknown handler type %q (must be command or http)", h.Type)
}
return nil
}
// Emit dispatches an event to all matching hooks.
func (hm *HookManager) Emit(event HookEvent) {
if hm == nil {
return
}
event.Project = hm.project
if event.Timestamp.IsZero() {
event.Timestamp = time.Now()View on GitHub (pinned to 4000b2338a)
Solutions
- Add the `url` key with the webhook endpoint for this hook
- Fix the field name spelling (must be `url`)
- Change type to "command" with a command if a local handler was intended
- Remove the hook entry if it is no longer needed
Example fix
// before (config.toml) [[hooks]] event = "after_agent" type = "http" // after [[hooks]] event = "after_agent" type = "http" url = "https://example.com/hooks/agent"
Defensive patterns
Strategy: validation
Validate before calling
for i, h := range hooks {
if h.Type == "http" && h.URL == "" {
return fmt.Errorf("hooks[%d]: url required for type=http", i)
}
} Try / catch
mgr, err := NewHookManager(hooks)
if err != nil {
slog.Error("invalid hook config", "err", err)
return fmt.Errorf("hook config: %w", err)
} Prevention
- Always include the `url` key when type = "http"
- Don't rename the field to `endpoint` — the struct key is `url`
- Validate hook config in CI before deployment
- Remove obsolete http hooks rather than leaving empty stubs
When it happens
Trigger: NewHookManager receives a hook with Type == "http" and an empty URL field — e.g. a [[hooks]] config entry with type = "http" but no url key.
Common situations: Config entry has type = "http" but the url key was omitted; URL accidentally deleted during edits; field misspelled (e.g. `endpoint` instead of `url`).
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- event is required
- command is required for type=command
- reasonix: create request: %w
- tmux: 'session' option is required (name of the tmux session
- config: relay.visibility must be "full", "summary", or "none
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/ece1f31ff1ec7c29.
Report an issue: GitHub.