abhigyanpatwari/GitNexus · warning
[cfg] ${pf.filePath}: skipped ${cfgs.length - wellFormed.len
Error message
[cfg] ${pf.filePath}: skipped ${cfgs.length - wellFormed.length} malformed cfgSideChannel element(s) (bad shape, missing id-anchor fields, or edge endpoints matching no block) — CFG for those functions omitted What it means
When emitting per-function CFGs from the persisted cfgSideChannel, each element is validated by isEmitSafeCfg (shape, id-anchor fields, edge endpoints must match real blocks). Elements failing the predicate are warned and skipped — CFG for those functions is simply omitted, while valid elements in the same array still emit (same policy as the parsedfile-store reviver).
Source
Thrown at gitnexus/src/core/ingestion/scope-resolution/pipeline/run.ts:1390
// into the Vue context pass) would re-emit identical ids from the same
// cfgSideChannel — the dedup-free streaming sink would double the rows.
// Skip it here; the in-memory-graph path needs no skip (its Map dedups).
if (input.pdgEmittedFiles !== undefined) {
if (input.pdgEmittedFiles.has(pf.filePath)) continue;
input.pdgEmittedFiles.add(pf.filePath);
}
try {
// Per-element emit-safety filter (mirrors the parsedfile-store
// reviver's POLICY: valid elements in a mixed array still emit; junk
// is warned and skipped). isEmitSafeCfg lives in cfg/emit.ts next to
// the id templating it defends — see its doc for why anchor-field and
// endpoint-membership checks are load-bearing. Runs INSIDE the try so
// even a predicate-time throw (e.g. a hostile getter) is isolated.
const wellFormed = (cfgs as readonly (FunctionCfg | undefined | null)[]).filter(
isEmitSafeCfg,
);
if (wellFormed.length < cfgs.length) {
logger.warn(
`[cfg] ${pf.filePath}: skipped ${cfgs.length - wellFormed.length} malformed ` +
`cfgSideChannel element(s) (bad shape, missing id-anchor fields, or edge ` +
`endpoints matching no block) — CFG for those functions omitted`,
);
}
if (wellFormed.length === 0) continue;
// U3 hook (#2227): the resolved-callee-id map for this file is
// `calleeIdAccumulator?.get(pf.filePath)` — joined here by exact
// call-site position to emit `BasicBlock.calleeIds`. Captured above at
// the three CALLS emit paths (U2); wired into `emitFileCfgs` by U3.
const emitted = emitFileCfgs(
pdgTarget,
wellFormed,
input.pdgMaxEdgesPerFunction ?? DEFAULT_MAX_CFG_EDGES_PER_FUNCTION,
// Log cap-overflow drops UNCONDITIONALLY (not via input.onWarn, which is
// gated behind the semantic-model validator and silent in production) so
// the per-function edge cap never truncates the CFG silently (R6/KTD6).
(message) => logger.warn(message),View on GitHub (pinned to 0d1aed942f)
Solutions
- Delete the stale index (.gitnexus store) and run a full re-analyze so the side-channel is regenerated by the current producer
- Check for version skew — make sure the same CLI version wrote and reads the store (npx gitnexus@latest vs a pinned older install)
- If it recurs on a fresh index, capture the file path from the warn and report it upstream with that file — a producer emitting non-emit-safe elements is a bug (isEmitSafeCfg exists to defend the id templating)
- Confirm recovery by re-running a pdg_query on the affected functions and checking CFG results appear
Example fix
# before npx gitnexus analyze # warn: skipped N malformed cfgSideChannel element(s) for src/foo.ts # after rm -rf .gitnexus npx gitnexus analyze # store regenerated; warn gone
Defensive patterns
Strategy: validation
Validate before calling
// Validate a persisted store before relying on its CFG coverage:
// after analyze, query a known function and fail if CFG is absent.
const r = await pdgQuery({ mode: 'controls', target: 'src/foo.ts:myFn' });
if (r.results.length === 0 && analyzeLog.includes('malformed cfgSideChannel')) {
await rebuildIndexFromScratch(); // rm -rf .gitnexus && re-analyze
} Type guard
// Mirror of the emit-safety predicate for side-channel consumers:
function isEmitSafeCfgLike(c: unknown): c is { id: string; blocks: unknown[]; edges: unknown[] } {
return (
typeof c === 'object' && c !== null &&
typeof (c as any).id === 'string' && (c as any).id.length > 0 &&
Array.isArray((c as any).blocks) && Array.isArray((c as any).edges)
);
} Prevention
- Never mix CLI versions against one .gitnexus store — re-analyze after upgrades
- Interrupted index runs are the top corruption source; treat any prior SIGKILL during analyze as a reason to re-index
- Fail CI on 'malformed cfgSideChannel' warnings rather than accepting silently reduced CFG coverage
When it happens
Trigger: Emit-phase CFG emission (pdgTarget configured) where a file's cfgSideChannel contains malformed elements: wrong shape, missing id-anchor fields needed by the id templating, or edges whose endpoints match no block. wellFormed.length < cfgs.length triggers the warn naming the file and count.
Common situations: A corrupted or partially-written .gitnexus parsed-file store (interrupted index), a store written by an older CLI version with a different cfgSideChannel schema, hand-modified index artifacts, or a producer bug that serialized cfg elements with missing anchor fields.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- [cfg] lang=${provider.language}: ${cdgSkippedUnsound} functi
- Invalid URL
- Only https:// and http:// git URLs are allowed
- ${name} must be a positive integer, got "${raw}"
- ${name} must be a non-negative integer, got "${raw}"
AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-08-20).
Data as JSON: /api/errors/100a47c916ffc076.
Report an issue: GitHub.