{"record":{"id":"f4897b6b19c50bdd","repo":"alibaba/spring-ai-alibaba","slug":"app-component-list-error","errorCode":"APP_COMPONENT_LIST_ERROR","errorMessage":"Failed to obtain component list.","messagePattern":"Failed to obtain component list\\.","errorType":"error_code","errorClass":"BizException","httpStatus":500,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/AppComponentController.java","lineNumber":113,"sourceCode":"\t}\n\n\t/**\n\t * Retrieves a paginated list of application components based on query parameters.\n\t * @param request Query parameters for filtering components including: - type:\n\t * Component type - name: Component name - appId: Associated application ID - status:\n\t * Component status - pageSize: Number of items per page - pageNum: Page number\n\t * @return Result containing a PagingList of AppComponent objects\n\t */\n\t@GetMapping()\n\tpublic Result<PagingList<AppComponent>> getAppComponentPageList(@ApiModelAttribute AppComponentQuery request) {\n\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\ttry {\n\t\t\tPagingList<AppComponent> appComponentList = appComponentService.getAppComponentList(request);\n\t\t\treturn Result.success(context.getRequestId(), appComponentList);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new BizException(ErrorCode.APP_COMPONENT_LIST_ERROR.toError());\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves a paginated list of applications that can be published as components.\n\t * This endpoint filters out applications that are already published as components.\n\t * @param request Query parameters including: - type: Application type - appName:\n\t * Application name\n\t * @return Result containing a PagingList of Application objects that can be published\n\t * as components\n\t */\n\t@GetMapping(\"/app-publishable\")\n\tpublic Result<PagingList<Application>> getAppPublishablePageList(@ApiModelAttribute AppComponentQuery request) {\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\tif (Objects.isNull(request.getType())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"type\"));\n\t\t}\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/AppComponentController.java#L95-L131","documentation":"AppComponentController.getAppComponentPageList wraps any exception thrown by appComponentService.getAppComponentList into a generic APP_COMPONENT_LIST_ERROR BizException. The controller deliberately discards the original cause, so the client only sees 'Failed to obtain component list.' The real failure (DB error, service wiring, bad query params) must be found in server logs.","triggerScenarios":"GET /appComponent page-list request where appComponentService.getAppComponentList(request) throws any Exception (database failure, service bean error, unexpected query state).","commonSituations":"Database down or connection pool exhausted; schema mismatch after upgrade; query parameters that cause the underlying query to fail.","solutions":["Check server logs/stack trace for the original exception swallowed by the catch block.","Verify database connectivity and that the component tables exist and are migrated.","Retry the list request; if persistent, reproduce with the same AppComponentQuery parameters.","Improve the code to log e (or chain it) so the cause is visible."],"exampleFix":"// before\ncatch (Exception e) {\n    throw new BizException(ErrorCode.APP_COMPONENT_LIST_ERROR.toError());\n}\n// after\ncatch (Exception e) {\n    log.error(\"Failed to obtain component list\", e);\n    throw new BizException(ErrorCode.APP_COMPONENT_LIST_ERROR.toError());\n}","handlingStrategy":"try-catch","validationCode":"// validate paging params before calling\nif (page == null || page < 1 || pageSize == null || pageSize > 100) throw new IllegalArgumentException('invalid paging');","typeGuard":null,"tryCatchPattern":"try {\n  const list = await api.getComponentPageList(query);\n} catch (e) {\n  if (e.code === 'APP_COMPONENT_LIST_ERROR') {\n    // fallback: show cached/empty list and log server correlation id\n  } else throw e;\n}","preventionTips":["Keep database migrations in sync before deploying.","Monitor DB connectivity/health of the admin server.","Always inspect server logs — the client error hides the root cause."],"tags":["database","server-error","component-list"],"backgroundTag":"database-query-failed","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"}