fix: prevent AttributeError crash when Llamafile model download fails#1734
Open
octo-patch wants to merge 1 commit intoopeninterpreter:mainfrom
Open
fix: prevent AttributeError crash when Llamafile model download fails#1734octo-patch wants to merge 1 commit intoopeninterpreter:mainfrom
octo-patch wants to merge 1 commit intoopeninterpreter:mainfrom
Conversation
When download_model() returns None (due to insufficient disk space or a network error), the subsequent model_path.split() call raises AttributeError: 'NoneType' object has no attribute 'split'. Add an early return after both the no-models and download-new-model paths so the interpreter is returned cleanly with a clear message instead of crashing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using
interpreter --localand selecting the Llamafile provider, ifdownload_model()fails (e.g. insufficient disk space, network error, or the user's machine can't fit any of the listed models), it returnsNone. The code then unconditionally executes:This crashes with
AttributeError: 'NoneType' object has no attribute 'split'instead of displaying a clear, actionable error.The bug affects two code paths in
local_setup.py:model_path = download_model(...)in theif not models:branch returnsNoneelsebranch;download_model()returnsNone; theif model_path:guard correctly skips the process launch, but execution still falls through to the crashing lineSolution
Add an early-return guard immediately before the Llamafile configuration block. When
model_path is None, print a clear message and return the interpreter unchanged — instead of crashing.Testing
model_path is None.download_model()returnNone; previously crashed withAttributeError, now exits cleanly with a user-friendly message.