abhigyanpatwari/GitNexus · error · Error
must not contain "@{"
Error message
must not contain "@{" What it means
validateAutoSyncBranchName rejects branch names containing "@{", which git reserves as the reflog/at-expression syntax (e.g. HEAD@{1}); such names are ambiguous or invalid as refs. The auto-sync config parser enforces this so a config can never produce a branch name git would refuse or misinterpret.
Source
Thrown at gitnexus/src/core/auto-sync/config.ts:345
) {
throw new Error(
'repository name must use only letters, digits, ".", "_", or "-" and must not be "unknown"',
);
}
}
export function validateAutoSyncBranchName(branch: string): void {
if (!branch.trim()) throw new Error('must not be empty');
if (/[\s\0-\x1f\x7f]/.test(branch))
throw new Error('must not contain whitespace or control characters');
if (/[~^:?*[\\]/.test(branch)) throw new Error('contains characters not allowed in a git ref');
if (branch.startsWith('-')) throw new Error('must not start with "-"');
if (branch.startsWith('/')) throw new Error('must not start with "/"');
if (branch.includes('..')) throw new Error('must not contain ".."');
if (branch.includes('`')) throw new Error('must not contain backticks');
if (branch.endsWith('/') || branch.endsWith('.')) throw new Error('must not end with "/" or "."');
if (branch.includes('//')) throw new Error('must not contain consecutive slashes');
if (branch.includes('@{')) throw new Error('must not contain "@{"');
if (
branch
.split('/')
.some(
(component) =>
component.startsWith('.') || component.endsWith('.') || component.endsWith('.lock'),
)
)
throw new Error('must not contain hidden, trailing-dot, or .lock path components');
}
export function parseDurationMs(value: unknown): number {
if (typeof value === 'number') return value * 1_000;
const raw = String(value ?? '').trim();
const match = /^(\d+)(ms|s|m)?$/.exec(raw);
if (!match) return Number.NaN;
const amount = Number(match[1]);
const unit = match[2] ?? 's';View on GitHub (pinned to 0d1aed942f)
Solutions
- Remove the "@{" sequence from the branch name.
- If a reflog or template expression was intended, resolve it to a concrete branch name before writing the config.
- Re-run parseAutoSyncConfig to confirm validation passes.
Example fix
// before
branch: "main@{yesterday}"
// after
branch: "main" Defensive patterns
Strategy: validation
Validate before calling
if (branch.includes('@{')) throw new Error('branch name must not contain "@{"'); Prevention
- Do not use reflog expressions like HEAD@{1} as branch names in config.
- Resolve template placeholders before writing the config file.
- Add a config-lint step that rejects "@{" in branch fields.
When it happens
Trigger: parseAutoSyncConfig receives a branch value containing the literal sequence "@{", e.g. "branch@{yesterday}" or "rel@{date}".
Common situations: Users pasting git reflog expressions into a branch-name config field, or templating syntax (@{...}) leaking through unresolved in the config file.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- must not contain backticks
- must not end with "/" or "."
- must not contain consecutive slashes
- must not contain hidden, trailing-dot, or .lock path compone
- must not include query strings or fragments
AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-09-08).
Data as JSON: /api/errors/703f53377dbf3593.
Report an issue: GitHub.