{"record":{"id":"05c9539e721cb0db","repo":"alibaba/spring-ai-alibaba","slug":"error-05c953","errorCode":null,"errorMessage":"未检测到模型配置文件: {}，以空配置启动（可稍后创建该文件触发热加载）","messagePattern":"未检测到模型配置文件: (.+?)，以空配置启动（可稍后创建该文件触发热加载）","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/repository/impl/FileModelConfigRepository.java","lineNumber":82,"sourceCode":"        loadFileOrFail();\n        startWatchService();\n    }\n    \n    private void resolveConfigPath() {\n        String configured = environment.getProperty(ENV_KEY);\n        if (configured != null && !configured.isBlank()) {\n            this.configPath = Paths.get(configured).toAbsolutePath().normalize();\n        } else {\n            this.configPath = Paths.get(\"./\" + DEFAULT_FILE).toAbsolutePath().normalize();\n        }\n        log.info(\"模型配置文件路径: {}\", this.configPath);\n    }\n    \n    private void loadFileOrFail() {\n        try {\n            if (!Files.exists(this.configPath)) {\n                this.snapshot.set(Collections.unmodifiableMap(new HashMap<>()));\n                log.warn(\"未检测到模型配置文件: {}，以空配置启动（可稍后创建该文件触发热加载）\", this.configPath);\n                return;\n            }\n            Map<Long, ModelConfigDO> data = loadFromFile(this.configPath);\n            this.snapshot.set(Collections.unmodifiableMap(data));\n            log.info(\"模型配置加载成功，数量: {}\", data.size());\n        } catch (Exception e) {\n            // 允许空配置启动：若解析失败，仍然以空配置启动\n            this.snapshot.set(Collections.unmodifiableMap(new HashMap<>()));\n            log.error(\"启动时加载模型配置失败，将以空配置启动: {}\", e.getMessage(), e);\n        }\n    }\n    \n    private Map<Long, ModelConfigDO> loadFromFile(Path file) throws IOException {\n        // 此方法假定调用方已判断文件存在\n        byte[] bytes = Files.readAllBytes(file);\n        YamlRoot root = yamlMapper.readValue(bytes, YamlRoot.class);\n        if (root == null || root.models == null) {\n            return new HashMap<>();","sourceCodeStart":64,"sourceCodeEnd":100,"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/repository/impl/FileModelConfigRepository.java#L64-L100","documentation":"FileModelConfigRepository loads model configuration from a local file at startup (afterPropertiesSet -> loadFileOrFail). If the configured configPath does not exist, it logs this warning and starts with an empty, unmodifiable snapshot instead of failing — the file can be created later to trigger hot reload. This is a warning-level diagnostic, not a thrown exception.","triggerScenarios":"Application startup where spring-ai-alibaba-admin-server-start's model config file property points to a path that does not exist on disk (file never created, wrong path configured, or the app runs in a fresh container/volume without the file mounted).","commonSituations":"First deployment before any model config was authored; Docker/Kubernetes volume without the config file; relative vs absolute path confusion causing the app to look in the working directory; renamed config file after an upgrade.","solutions":["Create the model config file at the logged path (this.configPath) — hot reload will pick it up without restart.","Point the repository's config-path property to the actual location of your existing model config file.","If running in a container, mount or bake the config file into the image at the expected path.","If starting empty is intentional, no action is needed — treat the log line as informational."],"exampleFix":"// before (application.yml)\nspring.ai.alibaba.admin.model-config.path: ./models.json   // file absent\n// after\nspring.ai.alibaba.admin.model-config.path: /etc/app/model-config.json   // file exists there","handlingStrategy":"validation","validationCode":"Path p = Path.of(configPathProperty);\nif (!Files.exists(p)) { log.warn(\"model config file absent: {} — create it or fix the path before expecting models\", p); }","typeGuard":null,"tryCatchPattern":"// The library itself handles the absence (warn + empty snapshot); only guard downstream reads:\nModelConfigDO cfg = repository.findById(id);\nif (cfg == null) { log.warn(\"no model config {} — file was missing at startup?\", id); }","preventionTips":["Verify the configured path exists in CI and container images before deploy","Use absolute paths for the model config file location","Mount the config file via volume in Kubernetes/Docker deployments","Rely on hot reload: create the file at runtime rather than restarting"],"tags":["config-file","startup","file-not-found","hot-reload"],"backgroundTag":"missing-config-file","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"}