Tencent/WeKnora · error

invalid thought: must be a non-empty string

Error message

invalid thought: must be a non-empty string

What it means

SequentialThinkingTool.validate rejects input whose Thought field is the empty string, since every reasoning step must carry actual thought text. Execute calls validate first, so this error aborts the tool call before any state is recorded. It enforces the required-argument contract of the sequential-thinking protocol.

Source

Thrown at internal/agent/tools/sequentialthinking.go:245

	)

	outputMsg := "Thought process recorded"
	if incomplete {
		outputMsg = "Thought process recorded - unfinished steps remain, continue exploring and calling tools"
	}

	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

  1. Provide a non-empty Thought string in the tool input.
  2. Validate that the thought argument is present and non-blank before calling Execute.
  3. If the model produced an empty thought, re-issue the request with clearer instructions.

Example fix

// before
in := SequentialThinkingInput{Thought: "", ThoughtNumber: 1, TotalThoughts: 3}
// after
in := SequentialThinkingInput{Thought: "Analyze the request structure", ThoughtNumber: 1, TotalThoughts: 3}
Defensive patterns

Strategy: validation

Validate before calling

if input.Thought == "" {
    return errors.New("sequential thinking input requires a non-empty thought")
}

Type guard

func validThought(in SequentialThinkingInput) bool { return in.Thought != "" }

Try / catch

if err := tool.Execute(ctx, input); err != nil && strings.Contains(err.Error(), "invalid thought") {
    // re-request the thought from the model or drop the step
}

Prevention

When it happens

Trigger: Calling Execute with SequentialThinkingInput where Thought == "", e.g. the model supplied only thoughtNumber/totalThoughts or the JSON argument omitted the thought field entirely.

Common situations: Model emits an empty thought argument; prompt scaffolding leaves the thought blank; JSON unmarshalling into the input struct drops a missing/empty "thought" key.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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