{"record":{"id":"c0cad6d6bc47f35a","repo":"alibaba/spring-ai-alibaba","slug":"graph-name-must-be-provided","errorCode":null,"errorMessage":"Graph name must be provided","messagePattern":"Graph name must be provided","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/strategy/FlowGraphBuildingStrategy.java","lineNumber":71,"sourceCode":"\t/**\n\t * Returns the type identifier for this strategy. This is used for registration and\n\t * lookup purposes.\n\t * @return the strategy type identifier\n\t */\n\tString getStrategyType();\n\n\t/**\n\t * Validates that the configuration contains all required parameters for this\n\t * strategy.\n\t * @param config the configuration to validate\n\t * @throws IllegalArgumentException if validation fails\n\t */\n\tdefault void validateConfig(FlowGraphBuilder.FlowGraphConfig config) {\n\t\tif (config == null) {\n\t\t\tthrow new IllegalArgumentException(\"Configuration cannot be null\");\n\t\t}\n\t\tif (config.getName() == null || config.getName().trim().isEmpty()) {\n\t\t\tthrow new IllegalArgumentException(\"Graph name must be provided\");\n\t\t}\n\t\tif (config.getRootAgent() == null) {\n\t\t\tthrow new IllegalArgumentException(\"Root agent must be provided\");\n\t\t}\n\t\tif (config.getKeyStrategyFactory() == null) {\n\t\t\t// Generate a new KeyStrategyFactory based on agent keys\n\t\t\tKeyStrategyFactory generatedFactory = generateKeyStrategyFactory(config);\n\t\t\tconfig.keyStrategyFactory(generatedFactory);\n\t\t}\n\t}\n\n\t/**\n\t * Generates a KeyStrategyFactory based on the root agent and sub-agents.\n\t * @param config the configuration containing agents\n\t * @return the generated KeyStrategyFactory\n\t */\n\tdefault KeyStrategyFactory generateKeyStrategyFactory(FlowGraphBuilder.FlowGraphConfig config) {\n\t\treturn () -> {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/strategy/FlowGraphBuildingStrategy.java#L53-L89","documentation":"The graph name is used as the node/state identifier when compiling the state graph; validateConfig rejects a null or blank name with IllegalArgumentException because downstream compilation cannot proceed without it.","triggerScenarios":"FlowGraphConfig built without calling name(...), or name set to \"\"/\" \" from an empty application property or request field.","commonSituations":"Binding graph name from external config (YAML/env) that is unset; copy-pasted builder code missing the name() call; dynamic flows where a user-supplied title was empty.","solutions":["Always call .name(\"...\") on the builder with a non-blank identifier","If the name comes from configuration, validate/trim it and apply a default before building","Add a pre-build assertion that config.getName() is non-blank"],"exampleFix":"// before\nFlowGraphBuilder.builder().rootAgent(root).build();\n// after\nFlowGraphBuilder.builder().name(\"order-flow\").rootAgent(root).build();","handlingStrategy":"validation","validationCode":"if (config.getName() == null || config.getName().trim().isEmpty()) throw new IllegalArgumentException(\"Graph name is required before build()\");","typeGuard":"static boolean hasName(FlowGraphBuilder.FlowGraphConfig c) { return c.getName() != null && !c.getName().trim().isEmpty(); }","tryCatchPattern":"try { return builder.build(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Graph name\")) { builder.name(defaultName); return builder.build(); } throw e; }","preventionTips":["Make name the first call in every builder chain","Validate externally supplied graph names at ingestion","Adopt a naming convention (e.g. kebab-case) enforced by tests"],"tags":["configuration","validation","graph-builder"],"backgroundTag":"missing-required-config-field","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}