{"record":{"id":"7075e6ae976c84ff","repo":"alibaba/spring-ai-alibaba","slug":"graph-not-found-7075e6","errorCode":null,"errorMessage":"Graph not found: ","messagePattern":"Graph not found: ","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-studio/src/main/java/com/alibaba/cloud/ai/agent/studio/loader/AbstractGraphLoader.java","lineNumber":98,"sourceCode":"\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic List<String> listGraphs() {\n\t\treturn List.copyOf(getGraphMap().keySet());\n\t}\n\n\t@Override\n\tpublic CompiledGraph loadGraph(String name) {\n\t\tif (name == null || name.trim().isEmpty()) {\n\t\t\tthrow new IllegalArgumentException(\"Graph name cannot be null or empty\");\n\t\t}\n\t\tCompiledGraph graph = getGraphMap().get(name);\n\t\tif (graph == null) {\n\t\t\tthrow new NoSuchElementException(\"Graph not found: \" + name);\n\t\t}\n\t\treturn graph;\n\t}\n}\n","sourceCodeStart":80,"sourceCodeEnd":103,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-studio/src/main/java/com/alibaba/cloud/ai/agent/studio/loader/AbstractGraphLoader.java#L80-L103","documentation":"AbstractGraphLoader.loadGraph(String name) throws NoSuchElementException when the name passes validation but no CompiledGraph is registered under that key in getGraphMap(). It signals an unknown/stale graph name, analogous to a map miss. The graph may never have been loaded or may have been unloaded since the name was obtained.","triggerScenarios":"Calling loadGraph(\"myGraph\") when \"myGraph\" is not a key in the graph map — wrong name, unloaded config, case mismatch, or the graph file was deleted after the client cached the name.","commonSituations":"Requesting a graph by name taken from a stale bookmark/API response; YAML graph definition removed from the watched config folder; typo between the registered graph name and the requested one; hot-reload removed the graph after a config edit.","solutions":["Enumerate available graph names (List.copyOf(getGraphMap().keySet()) is exposed by the loader) and pick an exact match","Correct the graph name spelling/case in the caller","Confirm the graph's YAML file exists in the watched config folder and was loaded successfully","If configs were reloaded, refresh the client's cached graph name list before retrying"],"exampleFix":"// before\nCompiledGraph g = loader.loadGraph(userSuppliedName);\n// after\nSet<String> available = loader.getGraphMap().keySet();\nif (userSuppliedName == null || !available.contains(userSuppliedName.trim())) {\n    throw new IllegalArgumentException(\"Unknown graph; available: \" + available);\n}\nCompiledGraph g = loader.loadGraph(userSuppliedName.trim());","handlingStrategy":"try-catch","validationCode":"if (graphName == null || !loader.getGraphMap().keySet().contains(graphName.trim())) {\n    throw new IllegalArgumentException(\"Unknown graph '\" + graphName + \"'; available: \" + loader.getGraphMap().keySet());\n}","typeGuard":null,"tryCatchPattern":"try {\n    return loader.loadGraph(graphName);\n} catch (NoSuchElementException e) {\n    logger.warn(\"Graph '{}' not found; available: {}\", graphName, loader.getGraphMap().keySet());\n    return ResponseEntity.status(404).body(\"Graph not found\");\n}","preventionTips":["Keep the client's graph-name list in sync with the loader after every config reload","Validate graph names against getGraphMap().keySet() at the request boundary","Watch studio loader logs for graph unregistration if names become stale"],"tags":["java","nosuch-element","graph-registry","lookup-failed"],"backgroundTag":"resource-not-found","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}