chenhg5/cc-connect · error
unknown validation error
Error message
unknown validation error
What it means
validateAppCredentials falls back to "unknown validation error" when the candidate loop ends with lastErr == nil, i.e. no candidate produced a definitive success or failure. This is a defensive placeholder indicating the validation loop never actually attempted a check.
Source
Thrown at cmd/cc-connect/feishu.go:493
var lastErr error
for _, candidate := range candidates {
base := openFeishuBaseURL
if candidate == "lark" {
base = openLarkBaseURL
}
ok, err := validateAppCredentialsAgainstBase(base, appID, appSecret)
if err != nil {
lastErr = err
continue
}
if ok {
return candidate, nil
}
lastErr = fmt.Errorf("remote returned non-zero code")
}
if lastErr == nil {
lastErr = fmt.Errorf("unknown validation error")
}
return "", lastErr
}
func validateAppCredentialsAgainstBase(baseURL, appID, appSecret string) (bool, error) {
body, _ := json.Marshal(map[string]string{
"app_id": appID,
"app_secret": appSecret,
})
req, err := http.NewRequest(http.MethodPost, baseURL+"/open-apis/auth/v3/tenant_access_token/internal", bytes.NewReader(body))
if err != nil {
return false, err
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Do(req)
if err != nil {View on GitHub (pinned to 4000b2338a)
Solutions
- Re-run with --debug if available to see which base URLs were attempted.
- Explicitly pass --platform-type feishu or lark so a valid candidate base URL is generated.
- Check network/proxy settings; if requests fail before producing an error the loop may never set lastErr.
- If reproducible, report as a bug — this message signals an unhandled path in validateAppCredentials.
Defensive patterns
Strategy: fallback
Validate before calling
if platformType == "" { platformType = "feishu" } // ensure a candidate base URL exists before validation Try / catch
if err != nil && strings.Contains(err.Error(), "unknown validation error") { log.Printf("validation loop produced no attempt; re-run with explicit --platform-type and debug enabled") } Prevention
- Always set --platform-type explicitly so at least one base URL candidate is generated.
- Use --debug to observe which validation attempts ran.
- Report persistent occurrences as a bug in candidate generation.
When it happens
Trigger: The candidate base URL list was empty, or every iteration hit the `continue` path without setting lastErr (an edge case in how candidates/errors are collected), leaving lastErr nil after the loop.
Common situations: Misconfigured or empty platform-type/base-URL candidate derivation; an internal edge case rather than a user-input mistake.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- app_id/app_secret are required
- invalid remote image URL
- invalid --platform-type %q, want feishu or lark
- decode response: %w
- %s: chatID is empty, cannot send new message
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/9277fbd74db49946.
Report an issue: GitHub.