affaan-m/ECC · error

Missing rendered content for repair

Error message

Missing rendered content for repair: ${operation.destinationPath}

What it means

Thrown during repair execution when a 'render-template' operation has no rendered text content available (getOperationTextContent returns null). The repair path re-executes recorded install operations and requires the template's rendered output to exist; without it, the destination file cannot be rewritten.

Solutions

  1. Re-run the install (install/update) to regenerate a complete install-state with rendered content, then repair
  2. Check the install-state record's operation entries for missing text/content fields and regenerate them
  3. Upgrade or downgrade to matching plugin/harness versions so state schema matches the repair code
  4. Delete the stale install-state record and perform a fresh install

Example fix

// before: repairing with stale state lacking rendered content
repairFromRecord(oldRecord)
// after: reinstall to regenerate state first
const record = await installAndUpdateState(manifest);
repairFromRecord(record);
Defensive patterns

Strategy: validation

Validate before calling

const repairable = record.state.operations.every(op => op.kind !== 'render-template' || op.text != null);
if (!repairable) throw new Error('state has render-template ops without rendered content; reinstall first');

Type guard

function hasRenderedContent(op) { return op.kind !== 'render-template' || (op != null && typeof op.text === 'string'); }

Try / catch

try { repairFromRecord(record); } catch (e) { if (String(e.message).startsWith('Missing rendered content')) { await reinstall(); } else throw e; }

Prevention

When it happens

Trigger: Calling the repair flow with an install-state record whose render-template operation lacks text content — e.g. the state was recorded by an older version that did not capture rendered output, or the operation object was constructed/parsed incompletely.

Common situations: Repairing after a plugin version upgrade changed the state schema; hand-editing or truncating the install-state JSON; running repair on a partial/corrupted state record.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/27abc046693ef31c. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/install-lifecycle.js:812

    if (operation.contentTransform || isMarkdownPath(operation.destinationPath)) {
      const source = readFileWithMetadataNoFollow(sourcePath, 'utf8');
      writeContainedFile(
        operation.destinationPath,
        getExpectedCopyFileContent(operation, source.content, linkIndex),
        trustedRoot,
        'repair',
        source.mode & 0o777
      );
    } else {
      copyContainedFile(sourcePath, operation.destinationPath, trustedRoot, 'repair');
    }
    return operation.destinationPath;
  }

  if (operation.kind === 'render-template') {
    const renderedContent = getOperationTextContent(operation);
    if (renderedContent === null) {
      throw new Error(`Missing rendered content for repair: ${operation.destinationPath}`);
    }

    writeContainedFile(operation.destinationPath, renderedContent, trustedRoot, 'repair');
    return operation.destinationPath;
  }

  if (operation.kind === 'merge-json') {
    const payload = getOperationJsonPayload(operation);
    if (payload === undefined) {
      throw new Error(`Missing merge payload for repair: ${operation.destinationPath}`);
    }

    const existingDestination = getContainedExistingPath(operation.destinationPath, trustedRoot, 'repair');
    const currentValue = existingDestination
      ? readJsonNoFollow(
        getManagedDestination(existingDestination, trustedRoot, 'repair').managedPath
      )
      : {};

View on GitHub (pinned to 8321021c54)