{"record":{"id":"f8a4fb29ccd4f95c","repo":"alibaba/spring-ai-alibaba","slug":"graph-not-found","errorCode":null,"errorMessage":"Graph not found: ","messagePattern":"Graph not found: ","errorType":"http","errorClass":"ResponseStatusException","httpStatus":404,"severity":"error","filePath":"spring-ai-alibaba-studio/src/main/java/com/alibaba/cloud/ai/agent/studio/controller/GraphController.java","lineNumber":86,"sourceCode":"\t *\n\t * @param graphName The name of the graph.\n\t * @return GraphResponse containing the Mermaid diagram source.\n\t */\n\t@GetMapping(\"/graphs/{graphName}/representation\")\n\tpublic GraphResponse getGraphRepresentation(@PathVariable String graphName) {\n\t\tif (graphName == null || graphName.isBlank()) {\n\t\t\tthrow new ResponseStatusException(org.springframework.http.HttpStatus.BAD_REQUEST,\n\t\t\t\t\t\"graphName cannot be null or empty\");\n\t\t}\n\t\ttry {\n\t\t\tCompiledGraph graph = graphLoader.loadGraph(graphName);\n\t\t\tString title = graph.stateGraph != null ? graph.stateGraph.getName() : graphName;\n\t\t\tGraphRepresentation repr = graph.getGraph(GraphRepresentation.Type.MERMAID, title);\n\t\t\treturn new GraphResponse(repr.content(), true);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tlog.warn(\"Failed to get graph representation for: {}\", graphName, e);\n\t\t\tthrow new ResponseStatusException(org.springframework.http.HttpStatus.NOT_FOUND,\n\t\t\t\t\t\"Graph not found: \" + graphName, e);\n\t\t}\n\t}\n}\n","sourceCodeStart":68,"sourceCodeEnd":91,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-studio/src/main/java/com/alibaba/cloud/ai/agent/studio/controller/GraphController.java#L68-L91","documentation":"GraphController.getGraphRepresentation converts any exception during graph loading or Mermaid rendering into a 404 NOT_FOUND ResponseStatusException with message 'Graph not found: <graphName>'. Because it catches all Exceptions, even rendering errors are surfaced as 'not found'.","triggerScenarios":"GET /graphs/{graphName}/representation where graphLoader.loadGraph(graphName) throws (unknown graph name, graph failed to compile) or graph.getGraph(MERMAID,...) throws.","commonSituations":"Typo in graph name; graph class not registered/loaded in the Studio application; graph bean fails to build at load time; caller assumes a graph exists that was never loaded.","solutions":["Check the graph name against the list returned by the graphs listing endpoint / graphLoader.listGraphs().","Look at the server log: the handler logs 'Failed to get graph representation' with the full stack trace before returning 404.","Fix graph registration/loading errors (missing bean, compile failure) so loadGraph succeeds.","If it's a rendering failure (not a missing graph), fix the graph structure rather than the name."],"exampleFix":"// before\nGET /graphs/agent grap/representation\n// after\nGET /graphs/agent-graph/representation  // name must match a loaded graph exactly","handlingStrategy":"validation","validationCode":"// client-side, before requesting representation\nconst graphs = await (await fetch('/graphs')).json();\nif (!graphs.includes(graphName)) throw new Error(`Graph '${graphName}' is not loaded`);","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(`/graphs/${graphName}/representation`);\n  if (res.status === 404) { /* check server logs: load vs render failure */ }\n} catch (e) { /* handle */ }","preventionTips":["Cross-check graph names against the graphs listing endpoint.","Register all graphs with Studio's GraphLoader at startup.","Read server logs: the 404 wraps any load or Mermaid rendering exception."],"tags":["http-404","rest","resource-not-found"],"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"}