{"record":{"id":"0c4206341a348d73","repo":"spring-projects/spring-ai","slug":"enforcing-streaming-of-the-model-pull-request","errorCode":null,"errorMessage":"Enforcing streaming of the model pull request","messagePattern":"Enforcing streaming of the model pull request","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"models/spring-ai-ollama/src/main/java/org/springframework/ai/ollama/api/OllamaApi.java","lineNumber":777,"sourceCode":"\t\t\t@JsonProperty(\"destination\") String destination\n\t) { }\n\n\t@JsonInclude(Include.NON_NULL)\n\tpublic record DeleteModelRequest(\n\t\t\t@JsonProperty(\"model\") String model\n\t) { }\n\n\t@JsonInclude(Include.NON_NULL)\n\tpublic record PullModelRequest(\n\t\t\t@JsonProperty(\"model\") String model,\n\t\t\t@JsonProperty(\"insecure\") boolean insecure,\n\t\t\t@JsonProperty(\"username\") @Nullable String username,\n\t\t\t@JsonProperty(\"password\") @Nullable String password,\n\t\t\t@JsonProperty(\"stream\") boolean stream\n\t) {\n\t\tpublic PullModelRequest {\n\t\t\tif (!stream) {\n\t\t\t\tlogger.warn(\"Enforcing streaming of the model pull request\");\n\t\t\t}\n\t\t\tstream = true;\n\t\t}\n\n\t\tpublic PullModelRequest(String model) {\n\t\t\tthis(model, false, null, null, true);\n\t\t}\n\t}\n\n\t@JsonInclude(Include.NON_NULL)\n\t@JsonIgnoreProperties(ignoreUnknown = true)\n\tpublic record ProgressResponse(\n\t\t\t@JsonProperty(\"status\") String status,\n\t\t\t@JsonProperty(\"digest\") String digest,\n\t\t\t@JsonProperty(\"total\") Long total,\n\t\t\t@JsonProperty(\"completed\") Long completed\n\t) { }\n","sourceCodeStart":759,"sourceCodeEnd":795,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/models/spring-ai-ollama/src/main/java/org/springframework/ai/ollama/api/OllamaApi.java#L759-L795","documentation":"Warning emitted from the PullModelRequest compact constructor in OllamaApi when a pull request is built with stream=false. Ollama's model-pull endpoint requires streaming progress updates, so the record silently overrides stream to true and logs a warning. The pull still works, but any code that expected a single non-streamed response will instead receive a stream.","triggerScenarios":"Constructing new PullModelRequest(model, false, username, password) or otherwise passing stream=false — the constructor unconditionally forces stream=true at models/spring-ai-ollama/.../OllamaApi.java:777.","commonSituations":"Copying request-building code from chat/inference (where streaming is optional) to the pull endpoint; writing a generic Ollama request factory that defaults stream=false; code written against an older Ollama API client before streaming was enforced.","solutions":["Build PullModelRequest with stream=true explicitly (or use the PullModelRequest(String model) convenience constructor) to silence the warning and match actual behavior.","Consume the response as a stream (Flux) regardless of the flag, since streaming is enforced.","Update any code paths that buffer/parse the pull response as a single body.","If a non-streaming pull is required, call the underlying HTTP endpoint directly, outside OllamaApi's PullModelRequest."],"exampleFix":"// before\nPullModelRequest req = new PullModelRequest(\"llama3\", false, null, null); // warns, stream forced true\n// after\nPullModelRequest req = new PullModelRequest(\"llama3\"); // stream defaults true, no warning","handlingStrategy":"validation","validationCode":"// build pulls only via the streaming-friendly constructor\nPullModelRequest req = new PullModelRequest(model); // stream defaults true, no warning","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass stream=false to PullModelRequest; it is overridden anyway","Consume pull responses as a Flux stream","Review request-builder code copied from non-streaming Ollama endpoints"],"tags":["ollama","model-pull","streaming","api-contract"],"backgroundTag":"conflicting-config-options","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"}