JuliusBrussee/caveman · warning

${bold("Protected")} ${model.protected}

Error message

${bold("Protected")}  ${model.protected}

What it means

In the learn TUI (clack-based), when the model carries a protected flag, renderLearnTui logs a warning line 'Protected <reason>' via p.log.warn before presenting action options. It is an informational UI message highlighting that something is protected, not a thrown error.

Solutions

  1. Read the warn text to see why the item is protected and adjust the model data if protection is stale
  2. Proceed with a different (unprotected) move from the TOP MOVES list
  3. Clear the protected flag in the learn model state if protection no longer applies
  4. No code change needed — this is an intentional informational warning
Defensive patterns

Strategy: try-catch

Type guard

function isProtected(model: LearnTuiModel): model is LearnTuiModel & { protected: string } {
  return typeof model.protected === 'string' && model.protected.length > 0
}

Try / catch

// informational warn, not an error — no catch needed; suppress in tests via clack mock
// e.g. mock p.log.warn to assert or silence the Protected message

Prevention

When it happens

Trigger: Rendering the learn TUI with a model whose `protected` field is set (non-empty reason string) — e.g. the learned move targets a protected file or protected area of the config.

Common situations: Users opening the learn flow after a run marked certain files/pivots as protected; reviewing moves that touch safeguarded config sections.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/e50d7f241e3dc2c3. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/learn-tui.ts:120

export async function renderLearnTui(model: LearnTuiModel): Promise<LearnTuiResult> {
  p.intro(`${green(bold(" CAVEMAN "))} ${dim("LEARN / LOCAL SETUP")}`);

  if (model.score !== null) {
    p.note(learnScoreBody(model), "SETUP SCORE");
  } else {
    p.note(learnScoreBody(model), "LEARN RESULT");
  }

  if (model.moves.length > 0) {
    const moves = model.moves.map((move, index) => {
      const number = dim(String(index + 1).padStart(2, "0"));
      return `${number}  ${learnMoveBody(move)}`;
    });
    p.note(moves.join("\n\n"), "TOP MOVES");
  }

  if (model.protected) {
    p.log.warn(`${bold("Protected")}  ${model.protected}`);
  }

  const options: Array<{ value: LearnTuiAction; label: string; hint?: string }> = [];
  if (model.moves.length > 0) {
    options.push({
      value: "implement",
      label: "Implement with agent",
      hint: "Claude Code or Codex · approval before edits",
    });
  }
  if (model.findings > 0) {
    options.push({
      value: "details",
      label: `Show all ${model.findings} findings`,
      hint: "full ids, evidence, and suggestions",
    });
  }
  options.push(

View on GitHub (pinned to 3ee70a1026)