abhigyanpatwari/GitNexus · error · Error
must not contain backticks
Error message
must not contain backticks
What it means
validateAutoSyncBranchName rejects branch names containing backticks, because git refs and the shell command construction around them treat backticks as command substitution. The auto-sync config parser calls this validator on every configured branch name, so a backtick in the config can never reach git. The check prevents both shell-injection and invalid-ref errors downstream.
Source
Thrown at gitnexus/src/core/auto-sync/config.ts:342
repoName === 'unknown' ||
repoName.startsWith('-') ||
!REMOTE_REPO_NAME_PATTERN.test(repoName)
) {
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);View on GitHub (pinned to 0d1aed942f)
Solutions
- Remove all backtick characters from the configured branch name in the auto-sync config.
- If a dynamic name was intended, resolve it before writing config (compute the branch name in code, not via shell substitution).
- Re-run config parsing to confirm the branch passes validateAutoSyncBranchName.
Example fix
// before branch: "release-`date +%Y`" // after branch: "release-2026"
Defensive patterns
Strategy: validation
Validate before calling
if (typeof branch === 'string' && branch.includes('`')) throw new Error('branch name must not contain backticks'); Prevention
- Never paste shell command-substitution syntax into branch-name config fields.
- Lint config files for backticks with a simple regex check in CI.
- Document that auto-sync branch names follow git check-ref-format rules.
When it happens
Trigger: Calling parseAutoSyncConfig with an auto-sync branch config value containing a backtick character anywhere in the name, e.g. branch: "main`id`" or "feature/`date`"
Common situations: Users pasting shell-style command-substitution snippets into config files, templated configs where a placeholder was written with backticks (e.g. `DATE`) and never substituted, or YAML values copied from shell scripts.
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 end with "/" or "."
- must not contain consecutive slashes
- must not contain "@{"
- 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/d4359c177d286aac.
Report an issue: GitHub.