vxcontrol/pentagi · error
code result handler is required
Error message
code result handler is required
What it means
GetCoderExecutor (flowToolsExecutor, backend/pkg/tools/tools.go:1177) validates a CoderExecutorConfig before constructing the coder tool executor. It refuses to build the executor when cfg.CodeResult is nil, because without a code-result handler the agent's code-execution results would have nowhere to be delivered. The check is a fail-fast guard; the companion check for cfg.Adviser is applied right after.
Source
Thrown at backend/pkg/tools/tools.go:1177
fte.embedder,
fte.db,
fte.cfg.EmbeddingMaxTextBytes,
fte.vslp,
fte.knp,
)
if guide.IsAvailable() {
ce.definitions = append(ce.definitions, registryDefinitions[StoreGuideToolName])
ce.definitions = append(ce.definitions, registryDefinitions[SearchGuideToolName])
ce.handlers[StoreGuideToolName] = guide.Handle
ce.handlers[SearchGuideToolName] = guide.Handle
}
return ce, nil
}
func (fte *flowToolsExecutor) GetCoderExecutor(cfg CoderExecutorConfig) (ContextToolsExecutor, error) {
if cfg.CodeResult == nil {
return nil, fmt.Errorf("code result handler is required")
}
if cfg.Adviser == nil {
return nil, fmt.Errorf("adviser handler is required")
}
if cfg.Installer == nil {
return nil, fmt.Errorf("installer handler is required")
}
if cfg.Memorist == nil {
return nil, fmt.Errorf("memorist handler is required")
}
if cfg.Searcher == nil {
return nil, fmt.Errorf("searcher handler is required")
}
View on GitHub (pinned to ea665308ba)
Solutions
- Set cfg.CodeResult to a non-nil handler (e.g. the flow's code-result processing function) before calling GetCoderExecutor.
- Add a pre-call guard that validates required handlers (CodeResult, Adviser) and returns a descriptive error identifying which field is missing.
- If code execution is intentionally disabled, skip GetCoderExecutor entirely instead of passing a partially-filled config.
- Consider giving CoderExecutorConfig a constructor/builder that requires CodeResult so the zero-value config cannot be used.
Example fix
// before
executor, err := fte.GetCoderExecutor(CoderExecutorConfig{
Adviser: adviser,
})
// after
executor, err := fte.GetCoderExecutor(CoderExecutorConfig{
CodeResult: flow.HandleCodeResult,
Adviser: adviser,
}) Defensive patterns
Strategy: validation
Validate before calling
if cfg.CodeResult == nil {
return nil, fmt.Errorf("GetCoderExecutor: cfg.CodeResult must be set before calling")
} Type guard
func (c CoderExecutorConfig) Valid() bool {
return c.CodeResult != nil && c.Adviser != nil
} Try / catch
executor, err := fte.GetCoderExecutor(cfg)
if err != nil {
return nil, fmt.Errorf("building coder executor: %w", err)
} Prevention
- Always build CoderExecutorConfig through a single constructor that fills CodeResult and Adviser.
- Add a unit test asserting GetCoderExecutor fails fast with a clear message for a zero-value config.
- Wrap the construction error with %w so the missing-handler cause is visible in logs.
When it happens
Trigger: Calling GetCoderExecutor with a CoderExecutorConfig literal that omits the CodeResult field (zero-value struct or partial config), or passing a variable that was conditionally assigned only on some code path so it remains nil at call time.
Common situations: Wiring up a new flow executor during refactoring and forgetting to inject the code-result callback; building the config from environment/feature flags where the code-result handler is only initialized when code-execution is enabled; copying an example that used a different executor constructor.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- invalid ToolcallStatus: %s
- bearer scheme must be used
- token can't be empty
- token validation disabled with default salt
- token is invalid
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/68126d91d5ea0fe0.
Report an issue: GitHub.