fix: clearer error when binary name used as pattern fallback - #2173
Open
OdinKral wants to merge 2 commits into
Open
fix: clearer error when binary name used as pattern fallback#2173OdinKral wants to merge 2 commits into
OdinKral wants to merge 2 commits into
Conversation
When fabric is invoked via a symlink or renamed binary (e.g. fabric-ai) without -p, the binary name was silently used as the pattern. If that pattern doesn't exist the user saw a confusing 'pattern not found' error with no indication that they forgot to specify -p. Adds patternFromBinaryName() helper and augments the chat error with a hint explaining that the binary name was used as the fallback pattern and how to specify one explicitly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds the English placeholder text for the hint added in the previous commit to all 10 non-English locale files so the key is present for translators and the i18n bundle is consistent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Jul 29, 2026
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.
Replaces #2117 — same commits, resubmitted from a personal fork.
On #2123 you were unable to push maintainer fixes to my branch:
That fork is owned by an organization, and GitHub's "allow edits by maintainers" grant only works for personally-owned forks — the API still reports
maintainerCanModify: true, so there was no signal from my side that anything was wrong. All of my open PRs were on that fork and had the same problem, so I've moved them toOdinKral/fabric-contrib, which is a personal fork. You should be able to push to these.Also rebased onto current main. #2117 had gone
CONFLICTINGbecause #2167 addedpattern_invalid_nameto the locale files this PR also touches; both keys are kept.go build ./internal/cli/passes and the addedTestPatternFromBinaryNamepasses all 6 subtests. (NoteTestBuildChatOptionsWithImageParametersfails, but it fails identically on a cleanupstream/main— pre-existing, unrelated to this PR.)Problem
Closes #2112.
When
fabricis invoked via a symlink or renamed binary (e.g.fabric-ai) without-p, the binary name is silently used as the pattern name. If that pattern doesn't exist, the user sees:There is no hint that the binary name was used as the fallback, so the user doesn't know to add
-p.Fix
Adds a
patternFromBinaryName()helper inflags.gothat checks whether the current pattern matches the binary-name fallback condition (mirrors the existing fallback logic). WhenhandleChatProcessingreturns an error and this condition is true, the error is wrapped with a hint:The symlink use-case (intentionally naming a binary after a pattern) is not broken — it still works the same way; the hint only appears when the pattern lookup fails.
Changes
internal/cli/flags.go— addpatternFromBinaryName()helperinternal/cli/cli.go— wrap chat error with hint when binary-name fallback is the likely causeinternal/i18n/locales/en.json— addpattern_from_binary_name_hinti18n keyinternal/cli/flags_test.go— 6 unit tests forpatternFromBinaryName()Test plan
go test ./internal/cli/...— newTestPatternFromBinaryNametests passfabrictofabric-ai, runecho "hi" | fabric-aiwithout patterns installed — verify new hint appears in error output-p summarizeas normal — verify no change in behavior