{"record":{"id":"b01d82d3dccd429d","repo":"alibaba/spring-ai-alibaba","slug":"app-component-queryconfig-error","errorCode":"APP_COMPONENT_QUERYCONFIG_ERROR","errorMessage":"Failed to query config of component.","messagePattern":"Failed to query config of component\\.","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":397,"sourceCode":"\t\tif (StringUtils.isBlank(appId)) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"appId\"));\n\t\t}\n\t\ttry {\n\t\t\tApplication application = appService.getApp(appId);\n\t\t\tif (application == null) {\n\t\t\t\tthrow new BizException(ErrorCode.APP_NOT_FOUND.toError());\n\t\t\t}\n\t\t\tAppComponentConfig applicationInputConfig = appComponentManager.getApplicationInputConfig(application,\n\t\t\t\t\ttrue);\n\t\t\tif (applicationInputConfig != null) {\n\t\t\t\tAppComponent appComponentDTO = new AppComponent();\n\t\t\t\tappComponentDTO.setConfig(JsonUtils.toJson(applicationInputConfig));\n\t\t\t\tappComponentDTO.setAppName(application.getName());\n\t\t\t\tappComponentDTO.setAppId(application.getAppId());\n\t\t\t\treturn Result.success(context.getRequestId(), appComponentDTO);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new BizException(ErrorCode.APP_COMPONENT_QUERYCONFIG_ERROR.toError());\n\t\t\t}\n\t\t}\n\t\tcatch (Exception exception) {\n\t\t\tthrow new BizException(ErrorCode.APP_COMPONENT_QUERYCONFIG_ERROR.toError());\n\t\t}\n\n\t}\n\n\t/**\n\t * Retrieves a list of components by their unique codes.\n\t * @param request Query containing a list of component codes to retrieve\n\t * @return Result containing a list of matching AppComponent objects\n\t */\n\t@PostMapping(\"/query-by-codes\")\n\tpublic Result<List<AppComponent>> listByCodes(@RequestBody AppComponentQuery request) {\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\tif (CollectionUtils.isEmpty(request.getCodes())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"codes\"));","sourceCodeStart":379,"sourceCodeEnd":415,"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#L379-L415","documentation":"Thrown by queryConfig when getApplicationInputConfig returns null for an existing application: the app exists but has no resolvable component configuration, so the endpoint fails with ErrorCode.APP_COMPONENT_QUERYCONFIG_ERROR instead of returning an empty config.","triggerScenarios":"GET /appComponent/{appId}/query-config where the application exists but getApplicationInputConfig(application, true) yields null (no published config / no input schema).","commonSituations":"Application never published or its config was never generated; app created from a template lacking an input schema; config records purged or corrupted.","solutions":["Publish or save the application so an input config is generated","Check the app's stored config/input-schema records for the appId","Return an explicit not-found/empty result for null configs instead of a generic error (code fix)","Retry after re-publishing the application"],"exampleFix":"// before\nelse {\n    throw new BizException(ErrorCode.APP_COMPONENT_QUERYCONFIG_ERROR.toError());\n}\n// after\nelse {\n    return Result.success(context.getRequestId(), new AppComponent()); // no config yet\n}","handlingStrategy":"try-catch","validationCode":"const app = await appApi.getApp(appId); if (!app || !app.published) throw new Error('app has no published config');","typeGuard":"const hasConfig = (dto) => dto !== null && typeof dto.config === 'string' && dto.config.length > 0;","tryCatchPattern":"try { ... } catch (e) { if (e.code === 'APP_COMPONENT_QUERYCONFIG_ERROR') { /* treat as missing config: republish app */ } else throw e; }","preventionTips":["Publish/save applications so an input config exists before querying","Distinguish 'no config yet' from a real server error in responses","Monitor config-generation jobs for the app"],"tags":["rest","config","internal-error"],"backgroundTag":"missing-config-value","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"}