Skip to content

Comments

fix: prevent _ensure_hf_token from swallowing click.Abort#937

Open
alfredoclarifai wants to merge 1 commit intomasterfrom
fix/ensure-hf-token-abort-handling
Open

fix: prevent _ensure_hf_token from swallowing click.Abort#937
alfredoclarifai wants to merge 1 commit intomasterfrom
fix/ensure-hf-token-abort-handling

Conversation

@alfredoclarifai
Copy link
Contributor

@alfredoclarifai alfredoclarifai commented Feb 10, 2026

Quick Fix Summary

  • Fix _ensure_hf_token swallowing click.Abort due to a broad except Exception handler, which was producing a misleading empty warning (Unexpected error ensuring HF_TOKEN:) and allowing execution to continue past an intentional abort

Root Cause

When config.yaml is missing, _ensure_hf_token correctly raises click.Abort(). But the outer except Exception catches it, downgrades it to a cryptic warning, and lets execution fall through to ModelBuilder._validate_folder which then crashes with a noisy AssertionError traceback.

Fix

Add except click.Abort: raise before the general except Exception so the abort propagates as intended.

Closes #936

Test plan

  • tests/cli/test_local_runner_cli.py — all 7 tests pass

🤖 Generated with Claude Code

The broad `except Exception` handler was catching `click.Abort`,
turning an intentional abort into a misleading warning with an
empty message and allowing execution to continue.

Closes #936

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 65%
clarifai.cli.templates 46%
clarifai.client 65%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 80%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.modules 0%
clarifai.rag 0%
clarifai.runners 52%
clarifai.runners.models 64%
clarifai.runners.pipeline_steps 41%
clarifai.runners.pipelines 77%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 60%
clarifai.utils 60%
clarifai.utils.evaluation 16%
clarifai.workflows 95%
Summary 61% (9852 / 16123)

Minimum allowed line rate is 50%

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: _ensure_hf_token swallows click.Abort, causing misleading warning

1 participant