Skip to content

[Bug] Changing context length and clicking Apply reloads with a missing config error, but the selected context length is applied after manually reloading the model #5238

Closed

Description

@okaybeydanol

Bug Description

When using Unsloth Studio with GGUF models, changing the context length and clicking Apply triggers a model reload. After waiting for some time, the reload fails with a “No config file found” error.

However, if I manually select/load the model again afterward, the last context length I selected is actually applied correctly.

So the setting appears to be saved, but the automatic reload path after changing context length fails incorrectly.

This is a small but confusing workflow bug. It does not completely block usage, because I can manually reload the model afterward and get the desired context length, but the error message makes it look like the model path/config is broken when it is not.


Error / Log Output

After changing context length and clicking Apply, Unsloth Studio shows:

Switching models. Reloading with updated chat template. Loading cached model into memory.
Failed to load model: This model is not supported yet. Try a different model. (Original error: Unsloth: No config file found - are you sure the `model_name` is correct? If you're using a model on your local device, confirm if the folder location exists. If you're using a HuggingFace online model, check if it exists.)

Environment

OS:

Lubuntu 24.04

Kernel:

6.17.0-22-generic

GPU:

NVIDIA RTX 5090 Laptop GPU

NVIDIA Driver:

595.58.03

CUDA:

CUDA Toolkit / CUDA Version: 13.1

Unsloth Studio environment:

Python: /home/theswalk/.unsloth/studio/unsloth_studio/bin/python
transformers: 4.57.6
torch: 2.10.0+cu130
unsloth: 2026.4.8
accelerate: 1.13.0
safetensors: 0.7.0

Model Type

This happens while working with GGUF models.

GGUF models otherwise load and run correctly on the same system. The issue appears only when changing the context length and using the automatic Apply / reload flow.


Steps to Reproduce

  1. Open Unsloth Studio.
  2. Load a local GGUF model.
  3. Confirm that the model loads and works normally.
  4. Change the context length setting.
  5. Click Apply.
  6. Wait while Studio attempts to reload the model.
  7. After some time, the reload fails with:
    No config file found - are you sure the `model_name` is correct?
    
  8. Manually select/load the same model again.
  9. The model loads successfully.
  10. The context length selected earlier is now applied correctly.

Expected Behavior

When changing context length and clicking Apply, Unsloth Studio should reload the same model cleanly with the updated context length.

Expected flow:

Change context length
Click Apply
Studio reloads the same model
Model loads successfully
New context length is active

No missing config error should appear if the model path is valid and the model can be loaded manually.


Actual Behavior

Unsloth Studio attempts to reload the model but fails with:

No config file found - are you sure the `model_name` is correct?

The confusing part is that the model itself is not actually missing or invalid.

After manually selecting/loading the same model again, it works, and the context length I selected before is applied.


Why This Seems Like a Bug

The error message suggests the local model folder or config is missing:

No config file found

But that does not match the actual situation because:

  1. The same GGUF model loads successfully before changing context length.
  2. The same GGUF model loads successfully again after the failed automatic reload.
  3. The selected context length is preserved and applied after manual reload.
  4. GGUF models may not have the same config file structure as safetensors/Hugging Face models, so the reload path may be using the wrong loader or wrong model reference during the automatic apply/reload step.

This suggests that the context-length Apply flow may be losing the correct local GGUF model path, using the wrong model identifier, or incorrectly switching to a Hugging Face / config-based loading path during reload.


Impact

This is not a complete blocker, but it is confusing and interrupts the workflow.

The workaround is:

1. Change context length.
2. Click Apply.
3. Wait for the reload to fail.
4. Manually select/load the same model again.
5. The selected context length is then active.

This works, but it should not be necessary.


Requested Fix

Please check the model reload logic after changing context length in Unsloth Studio, especially for local GGUF models.

Possible areas to inspect:

  1. Whether the automatic reload path preserves the correct local GGUF model path.
  2. Whether the reload path accidentally treats the GGUF model as a Hugging Face safetensors model.
  3. Whether the cached model reference loses the original file path.
  4. Whether the context-length apply flow updates settings but then calls the wrong loader.
  5. Whether the error message should be different for GGUF models.

Ideally, changing context length and clicking Apply should reload the same GGUF model directly without requiring the user to manually reselect the model.


Workaround

Manually reload the model after the failed automatic reload.

The selected context length is preserved, so after manually loading the same model again, the desired context length is applied.

Thank you.

Activity

  1. changed the title [-][Bug] Changing context length and clicking Apply reloads with a missing config error, but the selected context length is applied after manually reloading the model[Bug] Please fill in your issue title here.[/-] [+][Bug] Changing context length and clicking Apply reloads with a missing config error, but the selected context length is applied after manually reloading the model[/+] on Apr 30, 2026
  2. BlackBox-Labs commented on May 8, 2026

    @BlackBox-Labs

    Confirmed and fixed in PR #5332.

    Root cause: The already-loaded check at routes/inference.py:465 only handles GGUF models with a gguf_variant (HF repos). Local GGUF files loaded by file path have no variant, so the check was skipped, and the reload fell through to the HuggingFace/transformers path — which fails because GGUF files don't have a config.json.

    Fix: Added a local GGUF already-loaded handler that detects when a llama-server process is already running for the same model path. It kills the existing process before the GGUF reload path runs, ensuring the correct backend is used with the new settings.

    Tested on local GGUF (Qwen3.6). Settings change → Apply → model reloads cleanly. No error.

  3. Imagineer99 commented on May 8, 2026

    @Imagineer99
    Member

    unsloth: 2026.4.8 seems to be an outdated version, unable to repro in 2026.5.2, please update and confirm if its still occurring.

  4. Imagineer99 commented on May 8, 2026

    @Imagineer99
    Member

    which model are you testing with? just for further checks, ty.

  5. BlackBox-Labs commented on May 8, 2026

    @BlackBox-Labs

    Confirmed — we are on 2026.4.8. Testing with Qwen3.6-35B-A3B-UD-Q6_K.gguf loaded as a local GGUF file path (not HF repo). Will update to 2026.5.2 and retest.

  6. BlackBox-Labs commented on May 8, 2026

    @BlackBox-Labs

    Updated to 2026.5.2 and confirmed the bug still occurs with local GGUF files loaded by file path (not HF repo). The already-loaded check at line ~465 only handles GGUF models with a gguf_variant (HF repos). Local GGUF files have no variant, so they fall through to the else block at line ~515, and if the orchestrator's active_model_name matches, it returns already_loaded without ever reaching the GGUF reload path.

    The workaround is closing Unsloth Studio, restarting, and re-selecting the model. The automatic Apply reload does not work for local GGUFs even in 2026.5.2.

    Our PR #5332 has the proposed fix if you'd like to review. Happy to adjust based on team feedback.

  7. Imagineer99 commented on May 8, 2026

    @Imagineer99
    Member

    hm @BlackBox-Labs, how exactly are you loading the model, can you guide me through your steps?

  8. rolandtannous commented on May 14, 2026

    @rolandtannous
    Contributor

    @BlackBox-Labs @okaybeydanol
    installing from main repo, cannot reproduce your problem. here's a video demo. can you please share which model you have used?

    change_context_length_test.mp4
  9. okaybeydanol commented on May 16, 2026

    @okaybeydanol
    Author

    closes #5427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions