{"record":{"id":"d1ea7aff50137c6c","repo":"vxcontrol/pentagi","slug":"input-must-not-be-empty","errorCode":null,"errorMessage":"input must not be empty","messagePattern":"input must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/pkg/tools/flow_manager.go","lineNumber":703,"sourceCode":"\nfunc NewSubmitFlowInputTool(flowID int64, db database.Querier, handler func(ctx context.Context, input string) error) *submitFlowInputTool {\n\treturn &submitFlowInputTool{\n\t\tflowID:       flowID,\n\t\tdb:           db,\n\t\thandler:      handler,\n\t\tpollInterval: taskReadyPollInterval,\n\t\tpollTimeout:  taskReadyPollTimeout,\n\t}\n}\n\nfunc (t *submitFlowInputTool) Handle(ctx context.Context, name string, args json.RawMessage) (string, error) {\n\tvar action SubmitFlowInputAction\n\tif err := json.Unmarshal(args, &action); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to parse %s args: %w\", SubmitFlowInputToolName, err)\n\t}\n\n\tif action.Input == \"\" {\n\t\treturn \"\", fmt.Errorf(\"input must not be empty\")\n\t}\n\n\ttasks, err := t.db.GetFlowTasks(ctx, t.flowID)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to check flow status: %w\", err)\n\t}\n\n\tfor _, task := range tasks {\n\t\tif task.Status == database.TaskStatusRunning {\n\t\t\treturn fmt.Sprintf(\n\t\t\t\t\"Cannot submit input: task %q (ID: %d) is currently running. \"+\n\t\t\t\t\t\"Call %s first to stop the current execution, then retry %s. \"+\n\t\t\t\t\t\"Use %s to confirm the flow reaches 'waiting' state before retrying\",\n\t\t\t\ttask.Title, task.ID, StopFlowToolName, SubmitFlowInputToolName, GetFlowStatusToolName,\n\t\t\t), nil\n\t\t}\n\t}\n","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/flow_manager.go#L685-L721","documentation":"submit_flow_input parsed successfully but action.Input was an empty string, so the tool rejects the call before touching the database. Submitting empty input is meaningless — the tool exists to feed new instructions/data into a running flow — and this is an explicit domain validation rather than a JSON error.","triggerScenarios":"Calling submit_flow_input with {\"input\": \"\"}, {\"input\": \"   \"} is allowed only if not trimmed (empty string exactly), or with the input field omitted after a successful unmarshal into the zero-value struct (e.g. args = {}).","commonSituations":"LLM generates an empty input placeholder; a caller builds args dynamically from a variable that was empty; a UI form allowed submission without filling the field; variable interpolation produced an empty string.","solutions":["Provide a non-empty input string: {\"input\": \"<actual instruction or data>\"}.","Trim/validate the input at the call site before invoking the tool.","Fix upstream interpolation — check the variable feeding input is populated.","If input is optional, use a different flow-control tool instead of submitting empty input."],"exampleFix":"// before\nawait submitFlowInput(flowId, '');\n// after\nconst input = userText.trim();\nif (input) await submitFlowInput(flowId, input);","handlingStrategy":"validation","validationCode":"function validateSubmitInput(input: string): string {\n  const trimmed = input.trim();\n  if (!trimmed) throw new Error('input must not be empty');\n  return trimmed;\n}\n// call only after validation passes","typeGuard":"function hasNonEmptyInput(v: unknown): v is { input: string } {\n  return typeof v === 'object' && v !== null &&\n    typeof (v as any).input === 'string' && (v as any).input.length > 0;\n}","tryCatchPattern":"try {\n  await tool.call('submit_flow_input', { input });\n} catch (err) {\n  if (String(err).includes('input must not be empty')) {\n    // prompt user / regenerate a non-empty instruction\n  }\n}","preventionTips":["Trim and check input before every submit_flow_input call","Guard against empty variable interpolation feeding input","Require the field in UI forms before enabling submit","Use a different flow-control tool when there is nothing to submit"],"tags":["validation","input","tool-call","empty-value"],"backgroundTag":"empty-required-field","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}