abhigyanpatwari/GitNexus · error
Duplicate analysis feature descriptor: ${descriptor.id}
Error message
Duplicate analysis feature descriptor: ${descriptor.id} What it means
`resolveAnalysisFeatureVersions` encountered two `AnalysisFeatureDescriptor` entries with the same `id`. The feature registry requires unique ids because the id is the key stamped into index metadata and compared during rebuild detection. Duplicate ids would make rollback/mismatch detection ambiguous.
Source
Thrown at gitnexus/src/core/analysis-features.ts:38
/** Resolve the exact feature set this build promises for the supplied files. */
export function resolveAnalysisFeatureVersions(
descriptors: readonly AnalysisFeatureDescriptor[],
filePaths: readonly string[],
): Record<string, number> {
const resolved = new Map<string, number>();
const seenIds = new Set<string>();
for (const descriptor of descriptors) {
if (descriptor.id.trim().length === 0) {
throw new Error('Analysis feature descriptor id must not be empty');
}
if (!Number.isSafeInteger(descriptor.version) || descriptor.version < 1) {
throw new Error(
`Analysis feature "${descriptor.id}" has invalid version ${descriptor.version}`,
);
}
if (seenIds.has(descriptor.id)) {
throw new Error(`Duplicate analysis feature descriptor: ${descriptor.id}`);
}
seenIds.add(descriptor.id);
if (!descriptor.appliesTo(filePaths)) continue;
resolved.set(descriptor.id, descriptor.version);
}
return Object.fromEntries([...resolved].sort(([left], [right]) => left.localeCompare(right)));
}
/**
* Compare an untrusted metadata value with the exact capabilities produced by
* this build. Extra keys also mismatch: a rollback must rebuild instead of
* certifying graph semantics emitted only by a newer binary.
*/
export function findAnalysisFeatureMismatches(
actual: unknown,
expected: AnalysisFeatureVersions,
): readonly string[] {View on GitHub (pinned to d540b00184)
Solutions
- Remove the duplicate registration so each id appears exactly once.
- If both features are legitimate, give each a distinct namespaced id.
- Add a unit test asserting the descriptor list has unique ids.
Example fix
// before
[{ id: 'graph.x', version: 1, appliesTo: () => true },
{ id: 'graph.x', version: 2, appliesTo: () => true }]
// after
[{ id: 'graph.x', version: 2, appliesTo: () => true },
{ id: 'graph.y', version: 1, appliesTo: () => true }] Defensive patterns
Strategy: validation
Validate before calling
const ids = new Set();
for (const d of descriptors) {
if (ids.has(d.id)) throw new Error('Duplicate analysis feature: ' + d.id);
ids.add(d.id);
} Prevention
- Keep a single registry of descriptors to avoid duplicate registrations across modules.
- Use distinct namespaced ids so merges cannot collide.
When it happens
Trigger: Registering the same feature descriptor object twice, or two new descriptors that happen to share an id string (e.g. both start with 'graph.').
Common situations: A refactor that split a descriptor module but accidentally kept both the old and new registration; copy-paste of a descriptor without changing the id; merging two feature branches that each added a colliding id.
Related errors
- Analysis feature descriptor id must not be empty
- Analysis feature "${descriptor.id}" has invalid version ${de
- [understand-quickly] expected id of the form "owner/repo", g
- Unsupported provider: ${(config as any).provider}
- Invalid backend URL: must be a well-formed http:// or https:
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/b29781c2410a7c71.
Report an issue: GitHub.