{"record":{"id":"e87885df3c7f7124","repo":"iflytek/astron-agent","slug":"user-app-id-create-error","errorCode":"USER_APP_ID_CREATE_ERROR","errorMessage":"USER_APP_ID_CREATE_ERROR","messagePattern":"USER_APP_ID_CREATE_ERROR","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApiServiceImpl.java","lineNumber":97,"sourceCode":"\n    @Autowired\n    private ReleaseManageClientService releaseManageClientService;\n\n    private static final String PUBLISH_API = \"publish_api\";\n\n    private static final String BOT_API_MAAS_URL = \"/workflow/v1/chat/completions\";\n\n    @Override\n    public Boolean createApp(CreateAppVo createAppVo) {\n        String uid = RequestContextUtil.getUID();\n\n        if (appMstService.exist(createAppVo.getAppName())) {\n            throw new BusinessException(ResponseEnum.USER_APP_NAME_REPEAT);\n        }\n\n        String appId = tenantService.createApp(uid, createAppVo.getAppName(), createAppVo.getAppDescribe());\n        if (StringUtils.isBlank(appId)) {\n            throw new BusinessException(ResponseEnum.USER_APP_ID_CREATE_ERROR);\n        }\n        TenantAuth tenantAuth = tenantService.getAppDetail(appId);\n        if (Objects.isNull(tenantAuth)) {\n            throw new BusinessException(ResponseEnum.USER_APP_ID_CREATE_ERROR);\n        }\n        appMstService.insert(uid, appId, createAppVo.getAppName(), createAppVo.getAppDescribe(), tenantAuth.getApiKey(), tenantAuth.getApiSecret());\n\n        return true;\n    }\n\n    @Override\n    public List<AppListDTO> getAppList() {\n        String uid = RequestContextUtil.getUID();\n        return appMstService.getAppListByUid(uid)\n                .stream()\n                .map(appMst -> new AppListDTO(appMst.getAppId(), appMst.getAppName(), appMst.getAppDescribe(),\n                        appMst.getAppKey(), appMst.getAppSecret(), appMst.getCreateTime()))\n                .collect(Collectors.toList());","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApiServiceImpl.java#L79-L115","documentation":"USER_APP_ID_CREATE_ERROR is thrown when tenantService.createApp returns a blank appId, meaning the tenant microservice failed to allocate an application identity. The console records this as an app-creation failure before any local bookkeeping happens.","triggerScenarios":"Calling createApp when the tenant service (Go, core/tenant) is down, times out, rejects the request (quota, duplicate app at tenant level), or returns an empty/blank app identifier.","commonSituations":"Tenant service not deployed/reachable in the environment; tenant resource quota exhausted for the user/space; network or timeout between hub and tenant service; tenant DB write failing.","solutions":["Check core/tenant service health and logs (is it up? did createApp reach it?) and retry once healthy.","Verify the user/space hasn't hit tenant resource quotas; raise quota or free an app slot.","Inspect hub↔tenant connectivity (service discovery, network policy) and timeout settings.","If tenant-side duplicate detection rejects silently, align console and tenant uniqueness rules."],"exampleFix":"// before\nString appId = tenantService.createApp(uid, name, desc); // blank on silent failure\n// after\nif (StringUtils.isBlank(appId)) {\n    log.error(\"tenantService.createApp returned blank appId: uid={}, name={}\", uid, name);\n    throw new BusinessException(ResponseEnum.USER_APP_ID_CREATE_ERROR);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { publishApiService.createApp(vo); }\ncatch (BusinessException e) { if (e.getCode() == ResponseEnum.USER_APP_ID_CREATE_ERROR) { checkTenantServiceHealthThenRetry(); } else throw e; }","preventionTips":["Add health checks/alerts on the core/tenant service.","Enforce and surface tenant quotas before create attempts.","Set explicit timeouts and circuit breakers on hub→tenant calls."],"tags":["tenant","upstream-service","app-creation"],"backgroundTag":"upstream-api-error","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}