aaif-goose/goose · error · SystemExit
expected one match for {pattern!r} in {path}
Error message
expected one match for {pattern!r} in {path} What it means
SystemExit raised by replace_unique() in the bump-version recipe when re.subn finds zero occurrences of '^version\s*=\s*"[^"]+"' in one of the listed crate Cargo.toml files (count is capped at 1, so 'not 1' means 'not found'). The recipe demands exactly one literal version line per crate so it cannot silently skip or double-edit a manifest.
Source
Thrown at crates/goose-sdk/justfile:145
python_version = f"{major}.{minor}.{patch}" if alpha is None else f"{major}.{minor}.{patch}a{alpha}"
crate_names = [
"goose-provider-types",
"goose-sdk-types",
"goose-download-manager",
"goose-local-inference",
"goose-providers",
"goose-agent",
"goose-context-management",
"goose-sdk",
]
crate_paths = {name: Path("crates") / name / "Cargo.toml" for name in crate_names}
def replace_unique(path: Path, pattern: str, replacement: str) -> None:
text = path.read_text()
new_text, count = re.subn(pattern, replacement, text, count=1, flags=re.MULTILINE)
if count != 1:
raise SystemExit(f"expected one match for {pattern!r} in {path}")
path.write_text(new_text)
for path in crate_paths.values():
replace_unique(path, r'^version\s*=\s*"[^"]+"', f'version = "{rust_version}"')
dependency_names = [
"goose-provider-types",
"goose-sdk-types",
"goose-download-manager",
"goose-local-inference",
"goose-providers",
"goose-agent",
"goose-context-management",
]
for path in crate_paths.values():
text = path.read_text()
for dependency in dependency_names:
text = re.sub(View on GitHub (pinned to 3810898a74)
Solutions
- Grep the failing crate's manifest for the version line: rg '^version' crates/<name>/Cargo.toml — the failing path is printed in the error
- If it uses version.workspace = true, give it a literal version = "x.y.z" line (or drop it from crate_names)
- Run the recipe from crates/goose-sdk so the relative crates/<name>/Cargo.toml paths resolve
- Keep the crate_names list in the justfile in sync with reality when crates are added/renamed
Example fix
# before (crates/goose-sdk/Cargo.toml) [package] name = "goose-sdk" version.workspace = true # after [package] name = "goose-sdk" version = "0.1.0"
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
import re
for name in ["goose-provider-types","goose-sdk-types","goose-download-manager","goose-local-inference","goose-providers","goose-agent","goose-context-management","goose-sdk"]:
p = Path("crates")/name/"Cargo.toml"
assert p.is_file(), f"missing {p}"
assert re.search(r'^version\s*=\s*"[^"]+"', p.read_text(), re.M), f"no literal version line in {p}" Prevention
- Never switch SDK crates to version.workspace = true
- Add a CI check that every crate in crate_names has a literal version line
- Run bump-version from crates/goose-sdk only
- Update crate_names whenever crates are added/renamed
When it happens
Trigger: Running 'just bump-version <version>' when a crate in crate_names (goose-provider-types, goose-sdk-types, goose-download-manager, goose-local-inference, goose-providers, goose-agent, goose-context-management, goose-sdk) has no literal 'version = "..."' line — typically because its Cargo.toml uses 'version.workspace = true', the file was renamed/removed, or the recipe is run from a directory where crates/<name>/Cargo.toml does not resolve.
Common situations: A crate was switched to workspace-inherited versions; a new crate was added to the workspace but not given its own version line; running the recipe outside crates/goose-sdk so relative paths miss; a crate listed in the recipe was deleted/renamed.
Related errors
- rust_version must look like 0.1.0 or 0.1.0-alpha.0
- could not find findLibraryName in generated Kotlin bindings
- Could not create provider: provider '{}' not found
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/277e4bd9c4d07361.
Report an issue: GitHub.