Tencent/WeKnora · error

weknoracloud docreader submit response missing task_id

Error message

weknoracloud docreader submit response missing task_id

What it means

Fired in Read when the submit response decoded successfully but contains no task_id. The async read workflow cannot proceed without a task identifier, so this indicates a contract violation by the WeKnoraCloud service (or a schema drift in the response struct).

Source

Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:115

	resp, err := p.client.Do(httpReq)
	if err != nil {
		logger.Errorf(context.Background(), "[WeKnoraCloud] http read request failed: %v", err)
		return nil, fmt.Errorf("http read failed: %w", err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusAccepted && resp.StatusCode != http.StatusOK {
		bodyBytes, _ := io.ReadAll(resp.Body)
		logger.Errorf(context.Background(), "[WeKnoraCloud] http read unexpected status %d: %s", resp.StatusCode, string(bodyBytes))
		return nil, fmt.Errorf("http read status %d: %s", resp.StatusCode, string(bodyBytes))
	}
	var submit weKnoraCloudAsyncSubmitResponse
	if err := json.NewDecoder(resp.Body).Decode(&submit); err != nil {
		logger.Errorf(context.Background(), "[WeKnoraCloud] decode read submit response: %v", err)
		return nil, fmt.Errorf("http decode read submit response: %w", err)
	}
	if strings.TrimSpace(submit.TaskID) == "" {
		logger.Errorf(context.Background(), "[WeKnoraCloud] submit response missing task_id (status=%q message=%q)", submit.Status, submit.Message)
		return nil, fmt.Errorf("weknoracloud docreader submit response missing task_id")
	}
	logger.Infof(ctx, "[WeKnoraCloud] task submitted task_id=%s file=%q type=%q", submit.TaskID, req.FileName, req.FileType)
	return p.pollTaskResult(ctx, submit.TaskID)
}

type weKnoraCloudAsyncSubmitResponse struct {
	TaskID    string `json:"task_id"`
	Status    string `json:"status"`
	Message   string `json:"message"`
	CreatedAt int64  `json:"created_at"`
}

type weKnoraCloudAsyncTaskResponse struct {
	TaskID    string            `json:"task_id"`
	Status    string            `json:"status"`
	Message   string            `json:"message"`
	Progress  float64           `json:"progress"`
	Result    *httpReadResponse `json:"result"`

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Dump the decoded submit response to confirm the field name/tag mapping
  2. Check for API version drift between client struct tags and server payload
  3. Treat as a service defect and report; retrying is unlikely to help until the server is fixed
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:115 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/2d9d135efe696e12. Report an issue: GitHub.