larksuite/cli · error · LarkCliError

Missing row_count/column_count for sheet {sheet_title(sheet)

Error message

Missing row_count/column_count for sheet {sheet_title(sheet)!r}

What it means

Explicit remap targets are build-integrity declarations and must exist in the composed skill tree. skillref.New probes the target reference in the content FS and rejects the whole resolver if the target file is absent (unlike unmapped canonical references, which may be absent at resolve time).

Source

Thrown at skills/lark-sheets/scripts/lark_chart_layout_check.py:275

            for column_offset, cell in enumerate(row):
                if not _has_content(cell):
                    continue
                count += 1
                if len(samples) < sample_limit:
                    column = columns[column_offset] if isinstance(columns, list) and column_offset < len(columns) else index_to_column(column_offset)
                    samples.append(f"{column}{row_number}")
    return count, samples, truncated


def _locator(target: str) -> dict[str, str]:
    return {"url": target} if target.startswith(("http://", "https://")) else {"spreadsheet_token": target}


def _sheet_counts(sheet: dict[str, Any]) -> tuple[int, int]:
    row_count = int(sheet.get("row_count") or sheet.get("rowCount") or 0)
    column_count = int(sheet.get("column_count") or sheet.get("columnCount") or 0)
    if row_count <= 0 or column_count <= 0:
        raise LarkCliError(f"Missing row_count/column_count for sheet {sheet_title(sheet)!r}")
    return row_count, column_count


def check_sheet(
    locator: dict[str, str], sheet: dict[str, Any], *, timeout: int, sample_limit: int
) -> dict[str, Any]:
    sheet_id = sheet_identifier(sheet)
    title = sheet_title(sheet)
    row_count, column_count = _sheet_counts(sheet)
    if not sheet_id:
        raise LarkCliError(f"Missing sheet_id for sheet {title!r}")

    structure_data = envelope_data(
        run_sheets(
            "+sheet-info",
            **locator,
            sheet_id=sheet_id,
            flags={"include": "row_heights,col_widths"},

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Verify the target exists: run skillref probe semantics yourself (fs.FS open of the target path) or list the composed skill tree and correct the target string.
  2. Update stale remap targets to current skill names after a CLI upgrade (check `lark-cli` skill catalog/skills list).
  3. If authoring skills, ensure the target skill file is present in the embedded content and included in the composed tree before declaring a remap to it.
  4. Fix typos in the target skill name or path in the overlay config.

Example fix

// before
{From: mustParse("deploy/rollout.md"), To: mustParse("deploy/rollout-v2.md")} // target never existed
// after: point at the real target in the composed tree
{From: mustParse("deploy/rollout.md"), To: mustParse("deployment/rollout.md")}
Defensive patterns

Strategy: validation

Validate before calling

func targetExists(content fs.FS, ref skillref.Ref) error {
    path, err := skillref.RefPath(ref) // whatever path probe uses; or open via the skill tree
    if err != nil { return err }
    if _, err := fs.Stat(content, path); err != nil {
        return fmt.Errorf("remap target %q missing from composed tree", ref.String())
    }
    return nil
}

Type guard

func refExists(content fs.FS, r skillref.Ref) bool {
    res, err := skillref.New(content, []skillref.Mapping{})
    if err != nil { return false }
    _, ok := res.Resolve(r)
    return ok
}

Try / catch

r, err := skillref.New(content, mappings)
if err != nil {
    if errors.Is(err, skillref.ErrInvalidRemap) && strings.Contains(err.Error(), "does not exist") {
        // fall back to identity resolution or surface a config-validation error
    }
    return err
}

Prevention

When it happens

Trigger: Calling skillref.New with a Mapping whose To reference points to a skill path that does not exist in the supplied content fs.FS — e.g. target skill name misspelled, or the target skill file not included in the embedded/composed tree.

Common situations: Remapping to a skill that was renamed or removed in a newer CLI version; typos in the target skill/path in overlay configs; building against a fallback/empty embedded metadata that omits the skill; forgetting to add a new skill's files to the embed.

Related errors


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/052668e5e0b50233. Report an issue: GitHub.