Tencent/WeKnora · error

invalid response status code: %d

Error message

invalid response status code: %d

What it means

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.

Source

Thrown at internal/application/service/weknoracloud.go:89

	logger.Infof(ctx, "credential verification request: method=GET url=%s app_id=%s request_id=%s ",
		healthURL, appID, requestID)

	clientCfg := utils.DefaultSSRFSafeHTTPClientConfig()
	clientCfg.Timeout = 10 * time.Second
	client := utils.NewSSRFSafeHTTPClient(clientCfg)
	resp, err := client.Do(req)
	if err != nil {
		logger.Warnf(ctx, "credential verification HTTP failed: url=%s err=%v", healthURL, err)
		return fmt.Errorf("service unreachable: %w", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden {
		return fmt.Errorf("invalid APPID or APPSECRET (HTTP %d)", resp.StatusCode)
	}
	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("invalid response status code: %d", resp.StatusCode)
	}
	return nil
}

// CheckStatus 检查 WeKnoraCloud 凭证是否可正常解密
func (s *weKnoraCloudService) CheckStatus(ctx context.Context) (*types.WeKnoraCloudStatusResult, error) {
	tenantID := types.MustTenantIDFromContext(ctx)

	tenant, err := s.tenantRepo.GetTenantByID(ctx, tenantID)
	if err != nil || tenant == nil {
		return &types.WeKnoraCloudStatusResult{HasModels: false, NeedsReinit: false}, nil
	}

	creds := tenant.Credentials.GetWeKnoraCloud()
	if creds == nil {
		return &types.WeKnoraCloudStatusResult{HasModels: false, NeedsReinit: false}, nil
	}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check WeKnoraCloud service health/status for the reported code
  2. Retry if the status indicates a transient 5xx
  3. Verify the app_id/app_secret via the cloud console if 4xx persists
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/application/service/weknoracloud.go:89 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/3e27dbd229b1cdf6. Report an issue: GitHub.