{"record":{"id":"6b00b4de99cc9522","repo":"conductor-oss/conductor","slug":"inspectplan-agentconfig-is-required","errorCode":null,"errorMessage":"inspectPlan: agentConfig is required","messagePattern":"inspectPlan: agentConfig is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentService.java","lineNumber":131,"sourceCode":"                .build();\n    }\n\n    /**\n     * /dg #6: compile a plan against a PLAN_EXECUTE harness config and return the resulting\n     * Conductor WorkflowDef — without dispatching it. Lets callers inspect what PAC would produce\n     * before running.\n     *\n     * <p>Uses the same {@link PlanAndCompileTask#inspectPlan(Map, String, String, int, Set, Map)}\n     * path the runtime SUB_WORKFLOW dispatch uses, so there's exactly one compiler — no\n     * inspect-only divergence.\n     *\n     * <p>Caller must supply both the agent config (so the compile knows about the tool list, model,\n     * harness timeout) and the plan (typically what the planner LLM emitted, but can be a\n     * hand-rolled static plan for offline validation).\n     */\n    public PlanAndCompileTask.InspectResult inspectPlan(InspectPlanRequest request) {\n        if (request == null || request.getAgentConfig() == null) {\n            throw new IllegalArgumentException(\"inspectPlan: agentConfig is required\");\n        }\n        if (request.getPlan() == null) {\n            throw new IllegalArgumentException(\"inspectPlan: plan is required\");\n        }\n        AgentConfig config = request.getAgentConfig();\n        if (config.getName() == null || config.getName().isEmpty()) {\n            config.setName(\"agent_inspect\");\n        }\n        if (config.getStrategy() != AgentConfig.Strategy.PLAN_EXECUTE) {\n            throw new IllegalArgumentException(\n                    \"inspectPlan: agentConfig.strategy must be 'plan_execute', got '\"\n                            + (config.getStrategy() == null\n                                    ? \"null\"\n                                    : config.getStrategy().toValue())\n                            + \"'\");\n        }\n\n        // Replicate what MultiAgentCompiler.compilePlanExecute computes","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentService.java#L113-L149","documentation":"Thrown by AgentService.inspectPlan when the InspectPlanRequest is null or its agentConfig field is null. inspectPlan is a compile-only validation path that runs the PAC (Plan-And-Compile) task against a plan without dispatching. It requires both an AgentConfig (tool list, model, harness timeout) and a plan. IllegalArgumentException maps to HTTP 400.","triggerScenarios":"Calling inspectPlan(null); calling inspectPlan with a request object whose getAgentConfig() returns null; JSON deserialization produced a partial InspectPlanRequest missing the agentConfig key.","commonSituations":"Offline plan-validation tool or CI step sends an incomplete request body; SDK builds the request conditionally and skips the config when the agent is pre-deployed; API client omits agentConfig thinking the server will resolve it from a stored agent name (it will not — inspectPlan does not do name-based lookup).","solutions":["Ensure the InspectPlanRequest includes a fully populated AgentConfig before calling inspectPlan.","Add a null-check on request.getAgentConfig() in the caller before the API call.","If the config should come from a deployed agent, load it first via getAgentDef/getRegisteredAgent and construct the AgentConfig."],"exampleFix":"// before\nInspectPlanRequest req = new InspectPlanRequest();\nreq.setPlan(plan);\nservice.inspectPlan(req); // agentConfig is null -> error\n\n// after\nInspectPlanRequest req = new InspectPlanRequest();\nreq.setAgentConfig(agentConfig);\nreq.setPlan(plan);\nservice.inspectPlan(req);","handlingStrategy":"validation","validationCode":"if (request == null || request.getAgentConfig() == null) {\n    throw new IllegalStateException(\n        \"Cannot inspect plan: agentConfig must be provided in the request\");\n}\nservice.inspectPlan(request);","typeGuard":"// Java does not have structural type guards; use explicit null checks\nboolean canInspect = request != null\n    && request.getAgentConfig() != null\n    && request.getPlan() != null;","tryCatchPattern":null,"preventionTips":["Build InspectPlanRequest with a builder that enforces non-null agentConfig.","Add unit tests that verify inspectPlan rejects null agentConfig before integration.","Validate at the API controller layer to return 400 with a clearer field-level message."],"tags":["validation","inspect-plan","agent-config","bad-request"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}