affaan-m/ECC · error

Issue # cannot be published: review approval required…

Error message

Issue #${issueNumber} cannot be published: review approval required (current: ${state.review})

What it means

applyPublish enforces the review policy: when policy.review.required is true, the issue's coordination state must have review === 'approved' before publishing. Any other review state (pending, changes-requested, unset) blocks publication. The message includes the current review state so the developer knows what must change.

Solutions

  1. Obtain review approval (applyReview with approve) before publishing
  2. If review isn't needed for this issue, update the policy config to review.required = false
  3. Re-request review after addressing 'changes-requested' feedback so the state becomes 'approved'
  4. Check the issue's coordination state (labels/body marker) actually reflects the approval

Example fix

// before
applyPublish(repo, 42, {}) // current review: pending
// after
applyReview(repo, 42, { action: 'approve' }, ctx);
applyPublish(repo, 42, {})
Defensive patterns

Strategy: try-catch

Validate before calling

const state = getCoordinationState(getIssue(repo, n, opts), policy);
if (policy.review?.required && state.review !== 'approved') throw new Error(`review required, current: ${state.review}`);
applyPublish(repo, n, opts);

Try / catch

try { applyPublish(repo, n, opts); } catch (e) { if (String(e.message).includes('review approval required')) { console.error(`request review first; current state parsed from message: ${e.message}`); } throw e; }

Prevention

When it happens

Trigger: Calling applyPublish with a policy that sets review.required = true while getCoordinationState(issue, policy).review is not 'approved' — e.g. review still 'pending' or 'changes-requested' after a reviewer asked for edits.

Common situations: Publishing before any reviewer approved; a reviewer left 'changes-requested' and no re-approval happened after fixes; a repo adopted a review-required policy after issues were authored; CI attempting automated publish without a human review step.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at scripts/lib/github-coordination/actions.js:206

    validations,
    missingDependencies,
  };
}

function applyPublish(repo, issueNumber, options = {}, context = {}) {
  assertValidRepo(repo);
  assertValidIssueNumber(issueNumber);
  const policy = context.policy || loadPolicy(context.rootDir || process.cwd(), options.configPath);
  const issue = getIssue(repo, issueNumber, options);
  const state = getCoordinationState(issue, policy);
  const validation = applyValidate(repo, issueNumber, { ...options, dryRun: true }, context, issue);

  if (!validation.ok) {
    throw new Error(`Issue #${issueNumber} is not ready to publish: ${validation.validations.map(entry => `${entry.check}=${entry.ok}`).join(', ')}`);
  }

  if (policy.review && policy.review.required && state.review !== 'approved') {
    throw new Error(`Issue #${issueNumber} cannot be published: review approval required (current: ${state.review})`);
  }

  const nextState = buildIssueStateFromAction(issue, state, 'publish', {
    status: 'published',
    validation: 'passed',
    review: state.review === 'changes-requested' ? state.review : 'approved',
    projectState: 'done',
  }, policy);
  const trackedIssue = {
    ...issue,
    labels: desiredLabelsForState(nextState, policy),
  };

  if (!options.dryRun) {
    const body = mergeIssueBody(issue, nextState, policy);
    editIssue(repo, issueNumber, {
      body,
      addLabels: trackedIssue.labels,

View on GitHub (pinned to 8321021c54)