{"record":{"id":"b20b295d4cd135ca","repo":"alibaba/spring-ai-alibaba","slug":"parse-default-default-application-yml-failed","errorCode":null,"errorMessage":"parse default-default-application.yml failed","messagePattern":"parse default-default-application\\.yml failed","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/generator/GraphAppPropertiesCustomizer.java","lineNumber":44,"sourceCode":"public class GraphAppPropertiesCustomizer implements ApplicationPropertiesCustomizer {\n\n\tpublic GraphAppPropertiesCustomizer() {\n\t}\n\n\t@Override\n\tpublic void customize(ApplicationProperties properties) {\n\t\ttry (InputStream in = getClass().getClassLoader().getResourceAsStream(\"templates/default-application.yml\")) {\n\t\t\tif (in == null) {\n\t\t\t\tthrow new IllegalStateException(\"not found default-default-application.yml\");\n\t\t\t}\n\t\t\tYaml yaml = new Yaml();\n\t\t\tObject loaded = yaml.load(in);\n\t\t\tif (loaded instanceof Map<?, ?>) {\n\t\t\t\tflattenAndAdd(properties, \"\", (Map<String, Object>) loaded);\n\t\t\t}\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\tthrow new IllegalStateException(\"parse default-default-application.yml failed\", ex);\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate void flattenAndAdd(ApplicationProperties props, String prefix, Map<String, Object> map) {\n\t\tfor (Map.Entry<String, Object> entry : map.entrySet()) {\n\t\t\tString key = prefix.isEmpty() ? entry.getKey() : prefix + \".\" + entry.getKey();\n\t\t\tObject value = entry.getValue();\n\t\t\tif (value instanceof Map) {\n\t\t\t\tflattenAndAdd(props, key, (Map<String, Object>) value);\n\t\t\t}\n\t\t\telse if (value instanceof List) {\n\t\t\t\tprops.add(key, ((List<?>) value).toString());\n\t\t\t}\n\t\t\telse if (value instanceof Boolean) {\n\t\t\t\tprops.add(key, (Boolean) value);\n\t\t\t}\n\t\t\telse if (value instanceof Number) {","sourceCodeStart":26,"sourceCodeEnd":62,"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/generator/service/generator/GraphAppPropertiesCustomizer.java#L26-L62","documentation":"After locating templates/default-application.yml, customize() parses it with SnakeYAML (new Yaml().load(in)). Any parse error — malformed YAML, tabs, invalid structure — is wrapped in IllegalStateException('parse default-default-application.yml failed', ex). This signals a corrupted or hand-edited default template that the generator cannot interpret.","triggerScenarios":"customize() is invoked and the bundled templates/default-application.yml contains syntactically invalid YAML (bad indentation, tabs, unescaped characters) or a top-level non-map structure causing a cast/parse failure inside the try block.","commonSituations":"Editing the template file by hand and introducing YAML syntax errors, using tabs instead of spaces, resource filtering placeholders breaking YAML syntax, or a broken merge/rebase of the template.","solutions":["Validate templates/default-application.yml with a YAML linter or a quick SnakeYAML/J shell parse; fix the reported line from the cause exception","Replace tabs with spaces and fix indentation in the template","Check whether Maven resource filtering is mangling ${...} placeholders in the YAML — escape them or disable filtering for templates/","Restore the original template from the upstream spring-ai-alibaba repository"],"exampleFix":"// before (invalid YAML)\napplication:\n\tname: demo\n// after\napplication:\n  name: demo","handlingStrategy":"try-catch","validationCode":"try (InputStream in = getClass().getClassLoader().getResourceAsStream(\"templates/default-application.yml\")) {\n    new org.yaml.snakeyaml.Yaml().load(in); // throws if invalid\n}","typeGuard":null,"tryCatchPattern":"try {\n    customizer.customize(properties);\n} catch (IllegalStateException e) {\n    log.error(\"default-application.yml is invalid YAML: {}\", e.getCause(), e);\n}","preventionTips":["Lint YAML templates in CI (make yaml-lint)","Use spaces, never tabs, in templates","Escape Maven ${...} placeholders or disable filtering for templates/","Validate the file after every manual edit"],"tags":["yaml","snakeyaml","parsing","spring-boot"],"backgroundTag":"yaml-parse-error","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"}