{"record":{"id":"1f33a75bab9ffdc5","repo":"alibaba/spring-ai-alibaba","slug":"graph-not-found-1f33a7","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/GraphThreadController.java","lineNumber":79,"sourceCode":"\n\tprivate final ThreadService threadService;\n\n\t@Autowired\n\tpublic GraphThreadController(GraphLoader graphLoader, ThreadService threadService) {\n\t\tthis.graphLoader = graphLoader;\n\t\tthis.threadService = threadService;\n\t}\n\n\tprivate String toAppName(String graphName) {\n\t\treturn GRAPH_APP_PREFIX + graphName;\n\t}\n\n\tprivate void validateGraphExists(String graphName) {\n\t\tif (graphName == null || graphName.isBlank()) {\n\t\t\tthrow new ResponseStatusException(HttpStatus.BAD_REQUEST, \"graphName cannot be null or empty\");\n\t\t}\n\t\tif (!graphLoader.listGraphs().contains(graphName)) {\n\t\t\tthrow new ResponseStatusException(HttpStatus.NOT_FOUND, \"Graph not found: \" + graphName);\n\t\t}\n\t}\n\n\tprivate Thread findThreadOrThrow(String graphName, String userId, String threadId) {\n\t\tString appName = toAppName(graphName);\n\t\tOptional<Thread> optionalThread =\n\t\t\t\tthreadService.getThread(appName, userId, threadId, Optional.empty()).block();\n\n\t\tif (optionalThread == null || !optionalThread.isPresent()) {\n\t\t\tthrow new ResponseStatusException(HttpStatus.NOT_FOUND,\n\t\t\t\t\tString.format(\"Thread not found: graphName=%s, userId=%s, threadId=%s\",\n\t\t\t\t\t\t\tgraphName, userId, threadId));\n\t\t}\n\n\t\tThread thread = optionalThread.get();\n\t\tif (!Objects.equals(thread.appName(), appName) || !Objects.equals(thread.userId(), userId)) {\n\t\t\tthrow new ResponseStatusException(HttpStatus.NOT_FOUND,\n\t\t\t\t\t\"Thread found but belongs to a different graph/user.\");","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-studio/src/main/java/com/alibaba/cloud/ai/agent/studio/controller/GraphThreadController.java#L61-L97","documentation":"After the blank check, validateGraphExists compares graphName against graphLoader.listGraphs() and throws a 404 NOT_FOUND ResponseStatusException 'Graph not found: <graphName>' if it is not loaded. All thread endpoints call this before touching threads.","triggerScenarios":"Calling any thread endpoint (get/list/create/delete) with a graphName that is not registered in the Studio graph loader.","commonSituations":"Typo or case mismatch in graph name; graph exists in your app code but is not registered with Studio's GraphLoader; graph module not on the Studio classpath.","solutions":["Verify the exact graph name via the graphs listing endpoint / graphLoader.listGraphs().","Register the graph so it appears in listGraphs() (correct provider/bean configuration in Studio).","Fix typos and case sensitivity in the client's graphName."],"exampleFix":"// before\nawait fetch(`/graphs/MyGraph/users/u1/threads`); // not registered\n// after\nawait fetch(`/graphs/my-graph/users/u1/threads`); // name as returned by listGraphs()","handlingStrategy":"validation","validationCode":"// before calling thread APIs\nconst graphs = await (await fetch('/graphs')).json();\nif (!graphs.includes(graphName)) throw new Error(`Graph '${graphName}' not loaded in Studio`);","typeGuard":null,"tryCatchPattern":"try {\n  await api.get(`/graphs/${graphName}/users/${userId}/threads`);\n} catch (e) {\n  if (e.response?.status === 404 && e.response.data.includes('Graph not found')) {\n    const graphs = await api.get('/graphs'); // pick a valid name\n  }\n}","preventionTips":["Discover graph names dynamically from the listing endpoint.","Register graphs in Studio before using thread APIs.","Watch for typos and case sensitivity in graph names."],"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"}