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
- List groups with the group-list CLI / listGroups() to confirm the group name exists.
- If the group should exist, re-create it (createGroupDir writes the manifest template, then edit it).
- Catch GroupNotFoundError by name (instanceof GroupNotFoundError) to give a clean 'unknown group' UX rather than a generic error.
- 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
- Always branch on `instanceof GroupNotFoundError` rather than string-matching the message.
- Pre-check groupManifestExists if you want to avoid the throw entirely.
- Confirm GITNEXUS_HOME is set to the directory where the group was created.
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
- Invalid YAML: expected an object
- version is required in group.yaml
- Unsupported group.yaml version: ${raw.version}. Expected 1.
- name is required in group.yaml
- repos is required in group.yaml (must be a mapping)
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/61dd25660ec4a351.
Report an issue: GitHub.