镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[bugfix] Reject invalid --kernel-size with a usage error instead of a traceback (#604) - #605

Open
goranai wants to merge 1 commit into
Breakthrough:mainfrom
goranai:bugfix/kernel-size-validation
Open

goranai wants to merge 1 commit into
Breakthrough:mainfrom
goranai:bugfix/kernel-size-validation

Conversation

@goranai

@goranai goranai commented Nov 10, 2026

Copy link
Copy Markdown

Closes #604

-k/--kernel-size of detect-content and detect-adaptive was passed to ContentDetector unchecked, so 1, even or negative values ended in a ValueError traceback. It is now validated in CliContext and reported as click.BadParameter, as --weights and --downscale already are:

Error: Invalid value for kernel-size: Kernel size must be an odd integer >= 3.

KernelSizeValue also accepted kernel-size = 1 from a config file, contrary to its docstring, and the detector then raised. It now rejects values below 3 (except -1 = auto), and its message says ">= 3", matching the CLI help, scenedetect.cfg and the docs.

Note: on the command line -k -1 is now also rejected with a usage error. The CLI help never documented -1 for -k (only the config file does), and today -k -1 crashes with the same traceback.

Tests: test_cli_kernel_size_rejects_invalid (3 CLI cases) and test_cli_kernel_size_config_file_rejects_one (2 config cases) fail on main (5 failed) and pass with this change (5 passed). In the full suite the only failures are 2 moviepy tests that fail the same way on main because moviepy is not installed locally.

AI disclosure: prepared with Claude Code (Claude Opus 5.5) and reviewed by me.

🤖 Generated with Claude Code

… traceback (Breakthrough#604)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

detect-content / detect-adaptive -k with an invalid kernel size crashes with a traceback; config accepts kernel-size = 1

1 participant