{"record":{"id":"3e27dbd229b1cdf6","repo":"Tencent/WeKnora","slug":"invalid-response-status-code-d","errorCode":null,"errorMessage":"invalid response status code: %d","messagePattern":"invalid response status code: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/weknoracloud.go","lineNumber":89,"sourceCode":"\n\tlogger.Infof(ctx, \"credential verification request: method=GET url=%s app_id=%s request_id=%s \",\n\t\thealthURL, appID, requestID)\n\n\tclientCfg := utils.DefaultSSRFSafeHTTPClientConfig()\n\tclientCfg.Timeout = 10 * time.Second\n\tclient := utils.NewSSRFSafeHTTPClient(clientCfg)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlogger.Warnf(ctx, \"credential verification HTTP failed: url=%s err=%v\", healthURL, err)\n\t\treturn fmt.Errorf(\"service unreachable: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden {\n\t\treturn fmt.Errorf(\"invalid APPID or APPSECRET (HTTP %d)\", resp.StatusCode)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"invalid response status code: %d\", resp.StatusCode)\n\t}\n\treturn nil\n}\n\n// CheckStatus 检查 WeKnoraCloud 凭证是否可正常解密\nfunc (s *weKnoraCloudService) CheckStatus(ctx context.Context) (*types.WeKnoraCloudStatusResult, error) {\n\ttenantID := types.MustTenantIDFromContext(ctx)\n\n\ttenant, err := s.tenantRepo.GetTenantByID(ctx, tenantID)\n\tif err != nil || tenant == nil {\n\t\treturn &types.WeKnoraCloudStatusResult{HasModels: false, NeedsReinit: false}, nil\n\t}\n\n\tcreds := tenant.Credentials.GetWeKnoraCloud()\n\tif creds == nil {\n\t\treturn &types.WeKnoraCloudStatusResult{HasModels: false, NeedsReinit: false}, nil\n\t}\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/weknoracloud.go#L71-L107","documentation":"verifyCredentials wraps the non-2xx (and non-401/403) HTTP status returned by the WeKnoraCloud health endpoint during credential verification. The service was reachable (SSRF-safe client succeeded) but responded with an unexpected status, so credentials can't be confirmed.","triggerScenarios":"Thrown at internal/application/service/weknoracloud.go:89 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check WeKnoraCloud service health/status for the reported code","Retry if the status indicates a transient 5xx","Verify the app_id/app_secret via the cloud console if 4xx persists"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}