abhigyanpatwari/GitNexus · warning · GroupNotFoundError
Group " " not found
Error message
Group "${groupName}" not found What it means
GroupNotFoundError is thrown by loadGroupConfig() when reading <groupDir>/group.yaml fails with ENOENT — the group's manifest file does not exist, so the named group is unknown to gitnexus. The class sets name = 'GroupNotFoundError' precisely so callers (group service, cross-impact, cross-trace) can distinguish 'no such group' from other I/O or parse failures and report it as a user-facing not-found instead of a crash.
Solutions
- List the existing groups (gitnexus group list / the group status MCP resource) and use the exact registered name.
- If the group should exist, re-create or re-sync it so <groupDir>/group.yaml is written, and confirm the groups root path configuration.
- Check for name typos and case sensitivity — the lookup is by directory basename.
- In code, catch GroupNotFoundError via instanceof and degrade to a friendly 'unknown group' message rather than a stack trace.
Example fix
# before $ gitnexus impact "handler" --repo @mygroup # -> GroupNotFoundError: Group "mygroup" not found # after $ gitnexus group list my-group $ gitnexus impact "handler" --repo @my-group
Defensive patterns
Strategy: type-guard
Validate before calling
import { existsSync } from 'node:fs';
import { join } from 'node:path';
// Check before calling group APIs: manifest presence implies the group exists.
export function groupExists(groupsRoot: string, name: string): boolean {
return existsSync(join(groupsRoot, name, 'group.yaml'));
}
if (!groupExists(groupsRoot, groupName)) {
throw new Error(`unknown group "${groupName}" — run the group create/sync step first`);
} Type guard
import { GroupNotFoundError } from './core/group/config-parser.js';
export const isGroupNotFoundError = (e: unknown): e is GroupNotFoundError =>
e instanceof GroupNotFoundError;
// Also works across serialization boundaries:
// e instanceof Error && e.name === 'GroupNotFoundError' Try / catch
import { loadGroupConfig, GroupNotFoundError } from './core/group/config-parser.js';
try {
config = await loadGroupConfig(groupDir);
} catch (err) {
if (err instanceof GroupNotFoundError) {
// Expected user error: report, don't crash. err.groupName carries the name.
return { error: 'not-found', message: `Group "${err.groupName}" is not registered. List groups first.` };
}
throw err; // parse errors, permission errors, etc. are real failures
} Prevention
- Offer a group list command/resource in your UI so users pick an existing name instead of typing one.
- Check <groupsRoot>/<name>/group.yaml existence before issuing @group queries (cheap fs stat).
- Catch GroupNotFoundError by instanceof (or err.name === 'GroupNotFoundError') and render it as a 404-style message, never a stack trace.
- After moving the checkout or groups root, re-verify the root path configuration before blaming group names.
When it happens
Trigger: Using a @group command, MCP resource, or cross-repo impact/trace call with a group name that has no <group>/group.yaml under the groups root — mistyped name, group never created/synced, group directory deleted, or group.yaml renamed.
Common situations: Querying @mygroup before running the group create/sync step; a typo in the group name in an MCP query; the groups root living somewhere else than the tool was pointed at after moving the checkout.
Understand the failure class
Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.
Related errors
- Invalid YAML: expected an object
- links[ ].contract is required
- links[ ].from " " does not match any repo path in group
- links[ ].role " " is invalid. Expected: provider | consumer
- links[ ].to " " does not match any repo path in group
AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20).
Data as JSON: /api/errors/61dd25660ec4a351.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/core/group/config-parser.ts:152
}
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 52924ef12c)