chenhg5/cc-connect · error
feishu/lark platform located in parsed config but not raw fi
Error message
feishu/lark platform located in parsed config but not raw file
What it means
Companion to the previous error: the project span was found in the raw file, but the resolved absolute platform index (absIdx) has no corresponding platform span inside that project's raw block. Again a parsed-vs-raw consistency failure inside the helper's in-place editing machinery.
Source
Thrown at config/config.go:2109
platform.Options["app_id"] = strings.TrimSpace(opts.AppID)
platform.Options["app_secret"] = strings.TrimSpace(opts.AppSecret)
allowFrom := strings.TrimSpace(stringOption(platform.Options["allow_from"]))
if opts.SetAllowFromEmpty && strings.TrimSpace(opts.OwnerOpenID) != "" {
allowFrom = mergeAllowFromValue(allowFrom, strings.TrimSpace(opts.OwnerOpenID))
if allowFrom != "" {
platform.Options["allow_from"] = allowFrom
}
}
lines, hadTrailing := splitConfigLines(raw)
spans := buildRawProjectSpans(lines)
if projectIdx >= len(spans) {
return nil, fmt.Errorf("project %q located in parsed config but not raw file", opts.ProjectName)
}
if absIdx >= len(spans[projectIdx].platforms) {
return nil, fmt.Errorf("feishu/lark platform located in parsed config but not raw file")
}
reloadSpan := func() rawPlatformSpan {
spans = buildRawProjectSpans(lines)
return spans[projectIdx].platforms[absIdx]
}
span := spans[projectIdx].platforms[absIdx]
if opts.PlatformType != "" {
if span.typeLine >= 0 {
lines[span.typeLine] = replaceTomlStringKeyLine(lines[span.typeLine], "type", opts.PlatformType)
} else {
lines = insertLines(lines, span.start+1, []string{fmt.Sprintf("type = %s", quoteTomlString(opts.PlatformType))})
}
span = reloadSpan()
}
if span.optionsStart < 0 {View on GitHub (pinned to 4000b2338a)
Solutions
- Rewrite platform entries as standard [[projects.platforms]] blocks in config.toml.
- Remove commented-out or malformed platform table headers inside the project block.
- File a bug with the config content (secrets redacted) if standard formatting still triggers it.
Example fix
# before (raw scanner may miscount) [projects.platforms] type = "feishu" # after [[projects.platforms]] type = "feishu"
Defensive patterns
Strategy: try-catch
Try / catch
if err != nil && strings.Contains(err.Error(), "not raw file") {
slog.Error("raw/parsed config mismatch; falling back to full-file rewrite", "err", err)
// fallback: regenerate the config via the structured TOML encoder instead of in-place span editing
} Prevention
- Use standard array-of-tables syntax for platforms
- Remove commented-out platform table headers
- Test config edits against a copy of config.toml first
When it happens
Trigger: Calling the ensure-feishu-platform API (config/config.go:2109) when buildRawProjectSpans finds fewer platform sub-blocks inside the project's raw span than the TOML parser found — e.g. nested/unusual platform table formatting the raw scanner miscounts.
Common situations: Platforms declared with non-standard formatting (inline tables, dotted keys like projects.platforms.type) that the raw span builder does not count; commented-out platform blocks shifting the raw scan; concurrent file edits.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- parse existing Agy hooks %s: %w
- marshal Agy hooks overlay: %w
- tmux: 'session' option is required (name of the tmux session
- tmux: session %q does not exist and auto_create is disabled
- tmux: create session %q: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/df90173c6a1a360d.
Report an issue: GitHub.