Tencent/WeKnora · error
http new request: %w
Error message
http new request: %w
What it means
Fired in newSignedRequest when http.NewRequestWithContext cannot construct the request — almost always because the URL string is malformed (unparseable scheme/host) or the context is already cancelled. Called by both Read and pollTaskResult.
Source
Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:233
// Update interval for next iteration
nextInterval := time.Duration(float64(currentInterval) * 1.5)
if nextInterval > p.maxPollInterval {
nextInterval = p.maxPollInterval
}
currentInterval = nextInterval
}
}
}
func (p *WeKnoraCloudSignedDocumentReader) newSignedRequest(ctx context.Context, method, url string, body []byte) (*http.Request, error) {
requestID := uuid.New().String()
if len(body) == 0 {
body = []byte("{}")
}
httpReq, err := http.NewRequestWithContext(ctx, method, url, bytes.NewReader(body))
if err != nil {
logger.Errorf(context.Background(), "[WeKnoraCloud] http new request %s %s: %v", method, url, err)
return nil, fmt.Errorf("http new request: %w", err)
}
httpReq.Header.Set("Content-Type", "application/json")
httpReq.ContentLength = int64(len(body))
for k, v := range utils.Sign(p.appID, p.apiKey, requestID, string(body)) {
httpReq.Header.Set(k, v)
}
return httpReq, nil
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the endpoint URL constant/configuration parses as a valid URL
- Check whether the passed context was already cancelled
- This is a programming/config error; fix the URL rather than retry
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:233 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/b097faa2c1a8c9b6.
Report an issue: GitHub.