{"record":{"id":"e047e0d55e81ea25","repo":"spring-projects/spring-ai","slug":"could-not-create-default-cache-dir","errorCode":null,"errorMessage":"Could not create default cache dir","messagePattern":"Could not create default cache dir","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"auto-configurations/models/spring-ai-autoconfigure-model-transformers/src/main/java/org/springframework/ai/model/transformers/autoconfigure/TransformersEmbeddingModelProperties.java","lineNumber":50,"sourceCode":"\n/**\n * Configuration properties for the Transformer Embedding model.\n *\n * @author Christian Tzolov\n */\n@ConfigurationProperties(TransformersEmbeddingModelProperties.CONFIG_PREFIX)\npublic class TransformersEmbeddingModelProperties {\n\n\tpublic static final String CONFIG_PREFIX = \"spring.ai.embedding.transformer\";\n\n\tpublic static final String DEFAULT_CACHE_DIRECTORY;\n\n\tstatic {\n\t\ttry {\n\t\t\tDEFAULT_CACHE_DIRECTORY = Files.createTempDirectory(\"spring-ai-model-cache\").toAbsolutePath().toString();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new RuntimeException(\"Could not create default cache dir\", e);\n\t\t}\n\t}\n\n\t@NestedConfigurationProperty\n\tprivate final Tokenizer tokenizer = new Tokenizer();\n\n\t/**\n\t * Controls caching of remote, large resources to local file system.\n\t */\n\t@NestedConfigurationProperty\n\tprivate final Cache cache = new Cache();\n\n\t@NestedConfigurationProperty\n\tprivate final Onnx onnx = new Onnx();\n\n\t/**\n\t * Specifies what parts of the {@link Document}'s content and metadata will be used\n\t * for computing the embeddings. Applicable for the","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/auto-configurations/models/spring-ai-autoconfigure-model-transformers/src/main/java/org/springframework/ai/model/transformers/autoconfigure/TransformersEmbeddingModelProperties.java#L32-L68","documentation":"Static initializer failure in TransformersEmbeddingModelProperties: Files.createTempDirectory could not create the default local cache directory for downloaded transformer models (typical causes: no writable temp dir, no permissions, or an I/O error), so class initialization aborts.","triggerScenarios":"Thrown at auto-configurations/models/spring-ai-autoconfigure-model-transformers/src/main/java/org/springframework/ai/model/transformers/autoconfigure/TransformersEmbeddingModelProperties.java:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the java.io.tmpdir location exists and is writable by the process","Set spring.ai.embedding.transformer.cache-directory to an explicitly writable path instead of relying on the default","Check disk space and filesystem permissions"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}