Tencent/WeKnora · error
invalid thoughtNumber: must be >= 1
Error message
invalid thoughtNumber: must be >= 1
What it means
SequentialThinkingTool.validate returns this error when ThoughtNumber is less than 1. Thought numbering is 1-based, so 0 or negative values indicate malformed progress tracking. Execute invokes validate before processing, so the call is rejected outright.
Source
Thrown at internal/agent/tools/sequentialthinking.go:250
}
return &types.ToolResult{
Success: true,
Output: outputMsg,
Data: responseData,
}, nil
}
// validate validates the input thought data
func (t *SequentialThinkingTool) validate(data SequentialThinkingInput) error {
// Validate thought (required)
if data.Thought == "" {
return fmt.Errorf("invalid thought: must be a non-empty string")
}
// Validate thoughtNumber (required)
if data.ThoughtNumber < 1 {
return fmt.Errorf("invalid thoughtNumber: must be >= 1")
}
// Validate totalThoughts (required)
if data.TotalThoughts < 1 {
return fmt.Errorf("invalid totalThoughts: must be >= 1")
}
return nil
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Set ThoughtNumber to a value >= 1 matching the current step index.
- Validate/normalize the input (e.g. default ThoughtNumber to 1) before calling Execute.
- Ensure the model's JSON includes an integer thoughtNumber >= 1.
Example fix
// before
in := SequentialThinkingInput{Thought: "step text", ThoughtNumber: 0, TotalThoughts: 3}
// after
in := SequentialThinkingInput{Thought: "step text", ThoughtNumber: 1, TotalThoughts: 3} Defensive patterns
Strategy: validation
Validate before calling
if input.ThoughtNumber < 1 {
return errors.New("thoughtNumber must be >= 1")
} Type guard
func validThoughtNumber(in SequentialThinkingInput) bool { return in.ThoughtNumber >= 1 } Try / catch
if err := tool.Execute(ctx, input); err != nil && strings.Contains(err.Error(), "invalid thoughtNumber") {
input.ThoughtNumber = 1 // or correct and retry once
} Prevention
- Number thinking steps starting from 1, not 0
- Default thoughtNumber to 1 when omitted by the model
- Declare thoughtNumber as a required integer >= 1 in the tool schema
When it happens
Trigger: Calling Execute with SequentialThinkingInput.ThoughtNumber == 0 or negative — typically a zero-valued struct field because the JSON argument omitted thoughtNumber or the caller never set it.
Common situations: Model omits the thoughtNumber key; caller builds the input struct with only Thought set; off-by-one code that starts counting steps at 0.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- invalid thought: must be a non-empty string
- invalid totalThoughts: must be >= 1
- missing query
- invite code has expired
- join request not found
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/a013465a7cc5b3a2.
Report an issue: GitHub.