abhigyanpatwari/GitNexus · error

Analysis feature descriptor id must not be empty

Error message

Analysis feature descriptor id must not be empty

What it means

`resolveAnalysisFeatureVersions` iterated an `AnalysisFeatureDescriptor` whose `id` is empty or whitespace-only after trimming. Descriptors are code constants (not user input), so this is a programmer/build-time defect: a feature was registered without naming it. Each descriptor's id is part of the durable rebuild-vs-incremental contract stamped into index metadata.

Source

Thrown at gitnexus/src/core/analysis-features.ts:30

 * Existing v8 indexes predate the frameworkAnnotations column and therefore
 * need one full rebuild before any incremental Class write can be safe.
 */
export const CLASS_FRAMEWORK_ANNOTATIONS_FEATURE: AnalysisFeatureDescriptor = {
  id: 'graph.class-framework-annotations',
  version: 1,
  appliesTo: () => true,
};

/** 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)));
}

/**

View on GitHub (pinned to d540b00184)

Solutions

  1. Give the descriptor a non-empty, trimmed id, e.g. 'graph.class-framework-annotations'.
  2. Use a stable namespaced id so it does not collide with other features.
  3. Add a unit test asserting every registered descriptor has a non-empty id.

Example fix

// before
{ id: '', version: 1, appliesTo: () => true }
// after
{ id: 'graph.my-feature', version: 1, appliesTo: () => true }
Defensive patterns

Strategy: validation

Validate before calling

function assertDescriptorsWellFormed(descriptors) {
  for (const d of descriptors) {
    if (typeof d.id !== 'string' || d.id.trim().length === 0) {
      throw new Error('descriptor id must not be empty');
    }
  }
}

Type guard

const hasNonEmptyId = (d) =>
  typeof d.id === 'string' && d.id.trim().length > 0;

Prevention

When it happens

Trigger: Registering a descriptor like { id: '', version: 1, appliesTo: () => true } or { id: ' ', version: 1, ... } in the feature registry passed to `resolveAnalysisFeatureVersions`.

Common situations: Adding a new analysis feature descriptor and forgetting to set the id string; refactor that left a placeholder id; copy-paste of a descriptor template without filling the id.

Related errors


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