{"record":{"id":"246eb5b8054a9459","repo":"iflytek/astron-agent","slug":"database-create-failed","errorCode":"DATABASE_CREATE_FAILED","errorMessage":"DATABASE_CREATE_FAILED","messagePattern":"DATABASE_CREATE_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java","lineNumber":144,"sourceCode":"            if (count > 0) {\n                throw new BusinessException(ResponseEnum.DATABASE_NAME_EXIST);\n            }\n            // Call core system to create database\n            Long dbId = coreSystemService.createDatabase(databaseDto.getName(), userId, spaceId, databaseDto.getDescription());\n            // Save record\n            DbInfo database = new DbInfo();\n            BeanUtils.copyProperties(databaseDto, database);\n            database.setUid(userId);\n            database.setAppId(commonConfig.getAppId());\n            database.setDbId(dbId);\n            database.setCreateTime(new Date());\n            database.setUpdateTime(new Date());\n            database.setSpaceId(spaceId);\n            dbInfoMapper.insert(database);\n            return database;\n        } catch (Exception ex) {\n            log.info(\"Failed to create database, params:{}\", databaseDto.toString(), ex);\n            throw new BusinessException(ResponseEnum.DATABASE_CREATE_FAILED);\n        }\n    }\n\n    @Transactional\n    public void updateDateBase(DatabaseDto databaseDto) {\n        try {\n            dataPermissionCheckTool.checkDbUpdateBelong(databaseDto.getId());\n            // Name validation\n            DbInfo dbInfo = dbInfoMapper.selectById(databaseDto.getId());\n            if (StringUtils.isNotBlank(databaseDto.getDescription())) {\n                if (!databaseDto.getDescription().equals(dbInfo.getDescription())) {\n                    coreSystemService.modifyDataBase(dbInfo.getDbId(), UserInfoManagerHandler.getUserId(), databaseDto.getDescription());\n                }\n                dbInfo.setDescription(databaseDto.getDescription());\n            }\n            dbInfoMapper.updateById(dbInfo);\n        } catch (Exception ex) {\n            log.error(\"Failed to update database, params={}\", JSONObject.toJSONString(databaseDto), ex);","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java#L126-L162","documentation":"Generic catch-all in DatabaseService.create: any exception raised during the create flow (duplicate check query, coreSystemService.createDatabase RPC, DB insert) is converted into DATABASE_CREATE_FAILED. The original exception is logged with the request params. Because the BusinessException itself is caught by the same catch, even validation failures get re-wrapped as this error.","triggerScenarios":"coreSystemService.createDatabase fails (core service down, HTTP error); dbInfoMapper.insert fails (constraint violation, connection issue); any unexpected RuntimeException inside the try block, including rethrown BusinessExceptions from validation above.","commonSituations":"Core service unreachable or returning 5xx; DB connection pool exhausted; space quota exceeded downstream; null pointer from BeanUtils copy when a DTO field is missing.","solutions":["Inspect the log line 'Failed to create database, params:' for the root-cause stack trace","Verify the core system service is up and reachable","Check database connectivity and the db_info table constraints","Note the catch also masks DATABASE_NAME_EXIST/NAME_NOT_EMPTY — check cause chain for BusinessException"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { databaseService.create(dto); } catch (BusinessException e) { log.error(\"create failed\", e); /* inspect cause: core-system RPC or DB insert */ showGenericCreateFailure(); }","preventionTips":["Monitor coreSystemService health before create calls","Always read the server log 'Failed to create database, params:' for the root cause","Add unique pre-checks so validation errors are not masked by this catch-all","Set sensible timeouts on the core-system HTTP client"],"tags":["database","upstream","internal-error","java"],"backgroundTag":"database-write-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}