abhigyanpatwari/GitNexus · error · Error

errors.join('; ')

Error message

errors.join('; ')

What it means

parseAutoSyncConfig() accumulates all field-level validation problems (interval, timeouts, concurrency, remotes, etc.) into an `errors` array and throws them joined with '; ' when any exist. This single message aggregates every schema violation found in the auto-sync config file so users can fix them in one pass.

Source

Thrown at gitnexus/src/core/auto-sync/config.ts:271

      const overwriteLocalChanges =
        project.overwrite_local_changes === undefined ? false : project.overwrite_local_changes;
      if (typeof overwriteLocalChanges !== 'boolean') {
        errors.push(`projects[${index}].overwrite_local_changes must be a boolean`);
      }

      if (localPath && remoteUrls.length > 0 && branches.length > 0) {
        projects.push({
          localPath,
          groupName,
          overwriteLocalChanges: overwriteLocalChanges === true,
          branches,
          remoteUrls,
        });
      }
    });
  }

  if (errors.length > 0) throw new Error(errors.join('; '));
  return {
    configPath,
    syncIntervalMinutes: interval,
    repoGitTimeoutMs,
    analyzeTimeoutMs,
    maxConcurrency,
    analyzeFailureThreshold,
    projects,
  };
}

export function validateAutoSyncRemoteUrl(remoteUrl: string): void {
  const trimmed = remoteUrl.trim();
  if (trimmed.includes('?') || trimmed.includes('#')) {
    throw new Error('must not include query strings or fragments');
  }
  const match = /^git@([^:\s/]+):([^\s]+)$/.exec(trimmed);
  if (!match) {

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. Read each ';'-separated segment of the message and fix every listed field.
  2. Set sync_interval_minutes to a positive integer (minutes).
  3. Ensure timeouts and maxConcurrency are positive integers within allowed ranges.
  4. Fix remote entries so each passes validateAutoSyncRemoteUrl (SSH URL on allowed hosts, no query/fragment).
  5. Re-run the command; repeat until no errors are reported.

Example fix

// before
sync_interval_minutes: 0
analyze_timeout_ms: -5
// after
sync_interval_minutes: 30
analyze_timeout_ms: 600000
Defensive patterns

Strategy: validation

Validate before calling

const cfg = yaml.load(fs.readFileSync(path,'utf8'));
const errs = [];
if (!Number.isInteger(Number(cfg.sync_interval_minutes)) || Number(cfg.sync_interval_minutes) <= 0) errs.push('sync_interval_minutes must be a positive integer');
if (errs.length) throw new Error(errs.join('; '));

Try / catch

try {
  const cfg = loadAutoSyncConfig(path);
} catch (e) {
  for (const msg of String(e.message).split('; ')) console.error('-', msg.trim());
  process.exitCode = 1;
}

Prevention

When it happens

Trigger: Providing any invalid value in the auto-sync config: non-positive or non-integer sync_interval_minutes, negative timeouts, maxConcurrency < 1, malformed remote entries — anything pushed into the errors array.

Common situations: Setting sync_interval_minutes to 0 or 'hourly', negative analyzeTimeoutMs, forgetting units, or a hand-edited config with several typos at once.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-09-08). Data as JSON: /api/errors/f83e915746e9f294. Report an issue: GitHub.