Significant-Gravitas/AutoGPT · error · HTTPException

validation_error

Error message

validation_error

What it means

Raised (400) by the graph execute endpoint when graph validation (GraphValidationError) fails before scheduling. The detail is a structured object, not a string: {type: 'validation_error', message, node_errors} where node_errors maps node IDs to per-node problems — designed so the frontend can highlight the exact faulty nodes in the builder.

Source

Thrown at autogpt_platform/backend/backend/api/features/v1.py:2017

            organization_id=ctx.org_id,
            team_id=ctx.team_id,
        )
        # Record successful graph execution
        record_graph_execution(graph_id=graph_id, status="success", user_id=user_id)
        record_graph_operation(operation="execute", status="success")
        if source == "library":
            await complete_onboarding_step(user_id, OnboardingStep.LIBRARY_RUN_AGENT)
        elif source == "builder":
            await complete_onboarding_step(user_id, OnboardingStep.BUILDER_RUN_AGENT)
        return result
    except GraphValidationError as e:
        # Record failed graph execution
        record_graph_execution(
            graph_id=graph_id, status="validation_error", user_id=user_id
        )
        record_graph_operation(operation="execute", status="validation_error")
        # Return structured validation errors that the frontend can parse
        raise HTTPException(
            status_code=400,
            detail={
                "type": "validation_error",
                "message": e.message,
                # TODO: only return node-specific errors if user has access to graph
                "node_errors": e.node_errors,
            },
        )
    except Exception:
        # Record any other failures
        record_graph_execution(graph_id=graph_id, status="error", user_id=user_id)
        record_graph_operation(operation="execute", status="error")
        raise


@v1_router.post(
    path="/graphs/{graph_id}/executions/{graph_exec_id}/stop",
    summary="Stop graph execution",

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Parse detail.node_errors and surface each node's message at that node in the builder UI.
  2. Fix the flagged inputs/connections (supply required values, attach credentials) and re-run.
  3. If schemas changed, open the graph in the builder and re-save so it migrates to the current block schema.
  4. Use dry_run=true to validate without consuming credits while iterating.

Example fix

// before
catch (e) { alert('Run failed'); }

// after
const detail = e.response?.data?.detail;
if (detail?.type === 'validation_error') {
  for (const [nodeId, msg] of Object.entries(detail.node_errors)) {
    highlightNode(nodeId, msg);
  }
} else { throw e; }
Defensive patterns

Strategy: type-guard

Validate before calling

const missing = requiredInputs.filter(k => !inputs[k]);
if (missing.length) { highlightNodes(missing); return; }
await api.executeGraph(graphId, { inputs });

Type guard

interface GraphValidationDetail {
  type: 'validation_error';
  message: string;
  node_errors: Record<string, string>;
}
const isGraphValidationDetail = (d: unknown): d is GraphValidationDetail =>
  typeof d === 'object' && d !== null && (d as any).type === 'validation_error';

Try / catch

catch (e) {
  const detail = e.response?.data?.detail;
  if (isGraphValidationDetail(detail)) {
    for (const [nodeId, msg] of Object.entries(detail.node_errors)) markNodeInvalid(nodeId, msg);
  } else throw e;
}

Prevention

When it happens

Trigger: Executing a graph with invalid structure: unconnected required input pins, nodes missing required input values or credentials, cycles or subgraph wiring errors. The graph passes deserialization but fails validate_graph/credential checks at execution time.

Common situations: Running a half-built agent in the builder; another client edited the graph and left it invalid; a block's schema changed across versions so previously-valid inputs now fail validation; missing API-key credentials for LLM blocks.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/5a26e2f822fc40da. Report an issue: GitHub.