abhigyanpatwari/GitNexus · error · GroupNotFoundError

Group "${groupName}" not found

Error message

Group "${groupName}" not found

What it means

Thrown as GroupNotFoundError by loadGroupConfig when reading <groupDir>/group.yaml fails with ENOENT — the group directory exists in the path but has no group.yaml manifest. This is a distinct, named error class (not a generic Error) so callers can branch on it with instanceof. The constructor takes the group's basename for the message.

Source

Thrown at gitnexus/src/core/group/config-parser.ts:130

}

export class GroupNotFoundError extends Error {
  constructor(public readonly groupName: string) {
    super(`Group "${groupName}" not found`);
    this.name = 'GroupNotFoundError';
  }
}

export async function loadGroupConfig(groupDir: string): Promise<GroupConfig> {
  const fsp = await import('node:fs/promises');
  const path = await import('node:path');
  const yamlPath = path.join(groupDir, 'group.yaml');
  let content: string;
  try {
    content = await fsp.readFile(yamlPath, 'utf-8');
  } catch (err) {
    if ((err as NodeJS.ErrnoException).code === 'ENOENT') {
      throw new GroupNotFoundError(path.basename(groupDir));
    }
    throw err;
  }
  return parseGroupConfig(content);
}

View on GitHub (pinned to d540b00184)

Solutions

  1. List groups with the group-list CLI / listGroups() to confirm the group name exists.
  2. If the group should exist, re-create it (createGroupDir writes the manifest template, then edit it).
  3. Catch GroupNotFoundError by name (instanceof GroupNotFoundError) to give a clean 'unknown group' UX rather than a generic error.
  4. Verify GITNEXUS_HOME points at the directory where the group was actually created.

Example fix

// before — generic catch masks the not-found case
try { await loadGroupConfig(dir); }
catch (e) { console.error('failed', e.message); }

// after — branch on the named error class
import { GroupNotFoundError } from './config-parser.js';
try { await loadGroupConfig(dir); }
catch (e) {
  if (e instanceof GroupNotFoundError) console.error(`No such group: ${e.groupName}`);
  else throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

import * as fs from 'node:fs';
// pre-check existence before calling loadGroupConfig
function groupManifestExists(groupDir: string): boolean {
  try { return fs.statSync(`${groupDir}/group.yaml`).isFile(); }
  catch { return false; }
}

Try / catch

import { GroupNotFoundError, loadGroupConfig } from './config-parser.js';
try {
  const cfg = await loadGroupConfig(groupDir);
} catch (err) {
  if (err instanceof GroupNotFoundError) {
    // clean not-found UX — suggest listing groups
    console.error(`No such group: ${err.groupName}. Run group-list to see available groups.`);
    return;
  }
  throw err; // rethrow parse errors etc.
}

Prevention

When it happens

Trigger: Calling loadGroupConfig on a directory that doesn't contain group.yaml — either the group was never created, was partially deleted, or the wrong path was passed.

Common situations: Typo in the group name passed to a group command; the group directory was created manually without using createGroupDir (so no template was written); a cleanup removed group.yaml but left the directory; pointing at the wrong GITNEXUS_HOME.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/61dd25660ec4a351. Report an issue: GitHub.