larksuite/cli · error · ValueError
Invalid column index: {index}
Error message
Invalid column index: {index} What it means
skillref.New rejects a mappings list where the same source reference appears more than once. Each From key must be unique so the remap projection is unambiguous; duplicates would make resolution order-dependent.
Source
Thrown at skills/lark-sheets/scripts/lark_chart_layout_check.py:49
ACTION = "chart_layout_check"
DEFAULT_COLUMN_WIDTH = 105.0
DEFAULT_ROW_HEIGHT = 27.0
def column_to_index(column: str) -> int:
value = 0
text = str(column).strip().upper()
if not text or not text.isalpha():
raise ValueError(f"Invalid column: {column!r}")
for char in text:
value = value * 26 + ord(char) - ord("A") + 1
return value - 1
def index_to_column(index: int) -> str:
if index < 0:
raise ValueError(f"Invalid column index: {index}")
chars: list[str] = []
value = index + 1
while value:
value, remainder = divmod(value - 1, 26)
chars.append(chr(ord("A") + remainder))
return "".join(reversed(chars))
def _span_bounds(span: str, *, columns: bool) -> tuple[int, int]:
start, separator, end = str(span).partition(":")
end = end if separator else start
if columns:
return column_to_index(start), column_to_index(end)
return int(start) - 1, int(end) - 1
def _size_edges(
groups: Any,View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Remove or merge the duplicate mapping so each source reference appears exactly once.
- If entries come from multiple config layers, deduplicate by From.String() before constructing the Resolver, keeping the intended final target.
- De-duplicate programmatically: build a map keyed by From.String() and pass its values to skillref.New.
Example fix
// before
mappings := []skillref.Mapping{{From: a, To: b}, {From: a, To: c}} // duplicate source
// after: keep last-wins dedup
bySource := map[string]skillref.Mapping{}
for _, m := range raw { bySource[m.From.String()] = m }
uniq := make([]skillref.Mapping, 0, len(bySource))
for _, m := range bySource { uniq = append(uniq, m) } Defensive patterns
Strategy: validation
Validate before calling
func dedupeMappings(ms []skillref.Mapping) []skillref.Mapping {
seen := map[string]bool{}
out := make([]skillref.Mapping, 0, len(ms))
for _, m := range ms {
k := m.From.String()
if seen[k] { continue }
seen[k] = true
out = append(out, m)
}
return out
} Prevention
- Deduplicate overlay entries by source reference before calling skillref.New.
- When merging config layers, replace entries by key instead of appending.
- Add a config lint that fails on duplicate remap sources.
When it happens
Trigger: Calling skillref.New with a mappings slice containing two Mapping entries whose From.String() values are identical (e.g. the same skill remapped twice, or the same exact source path declared in two overlay entries).
Common situations: Merging overlay fragments from multiple config layers that each remap the same skill; copy-pasted remap entries in a config file; automated config generation that appends instead of replacing entries.
Related errors
- Invalid column: {column!r}
- anchor outside sheet: {position!r}
- Missing row_count/column_count for sheet {sheet_title(sheet)
- Missing sheet_id for sheet {title!r}
- malformed config
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/11b106da6641e358.
Report an issue: GitHub.