larksuite/cli · error · LarkCliError

Missing sheet_id for sheet {title!r}

Error message

Missing sheet_id for sheet {title!r}

What it means

Raised by the chart layout check when a worksheet in the spreadsheet's sheet list matches the requested title but carries no sheet_id, so later layout API calls have no target identifier. It fires when the metadata payload (title) and the identifier payload (sheet_id) disagree - typically a truncated or nonstandard sheets metadata response.

Source

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

    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"},
            timeout=timeout,
        )
    )
    row_edges, column_edges, warnings = build_layout(
        extract_sheet_structure(structure_data), row_count, column_count
    )
    chart_data = envelope_data(
        run_sheets("+chart-list", **locator, sheet_id=sheet_id, timeout=timeout)
    )
    charts = extract_charts(chart_data, sheet_id, title)

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Use exactly "separate" or "suite" as the layout value (empty string is allowed and means default/effective).
  2. Check the configured value with `lark-cli skills` docs or --help for the accepted flag values and correct the spelling.
  3. If the value comes from a saved SkillsState, fix or delete the stale layout field so EffectiveLayout falls back to "separate".

Example fix

// before
layout, err := skillscheck.ParseLayout("seperate") // typo
// after
layout, err := skillscheck.ParseLayout("separate")
if err != nil { return err }
Defensive patterns

Strategy: validation

Validate before calling

func validLayout(v string) bool {
    switch skillscheck.Layout(strings.TrimSpace(v)) {
    case "", skillscheck.LayoutSeparate, skillscheck.LayoutSuite:
        return true
    }
    return false
}

Type guard

func asLayout(v string) (skillscheck.Layout, bool) {
    l, err := skillscheck.ParseLayout(v)
    return l, err == nil
}

Try / catch

layout, err := skillscheck.ParseLayout(flagValue)
if err != nil {
    return fmt.Errorf("--layout must be 'separate' or 'suite'")
}

Prevention

When it happens

Trigger: Calling skillscheck.ParseLayout with a layout string other than "separate" or "suite" (e.g. "combined", " Suites" after trim fails, "seperate"), or passing a non-empty --layout flag value from updateRun/runSkillsAndState/ResolveLayout.

Common situations: Typing the layout flag value wrong on the command line; a config/state file with a hand-edited layout field; scripts passing a stale layout name after the enum shrank to two values.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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