{"record":{"id":"d908d4402fc19766","repo":"chenhg5/cc-connect","slug":"claudecode-missing-usage-percentage-in-s-block","errorCode":null,"errorMessage":"claudecode: missing usage percentage in %s block","messagePattern":"claudecode: missing usage percentage in (.+?) block","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/claudecode/claude_usage.go","lineNumber":375,"sourceCode":"\t\tif i > start+1 && (strings.HasPrefix(lower, \"current \") || strings.HasPrefix(lower, \"extra usage\")) {\n\t\t\tbreak\n\t\t}\n\t\tif usedPercent == nil {\n\t\t\tif m := claudeUsagePercentRe.FindStringSubmatch(line); len(m) == 2 {\n\t\t\t\tv, _ := strconv.Atoi(m[1])\n\t\t\t\tusedPercent = &v\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif resetRaw == \"\" {\n\t\t\tif m := claudeUsageResetLineRe.FindStringSubmatch(line); len(m) == 2 {\n\t\t\t\tresetRaw = strings.TrimSpace(m[1])\n\t\t\t}\n\t\t}\n\t}\n\n\tif usedPercent == nil {\n\t\treturn core.UsageWindow{}, fmt.Errorf(\"claudecode: missing usage percentage in %s block\", header)\n\t}\n\n\twindow := core.UsageWindow{\n\t\tName:          header,\n\t\tUsedPercent:   *usedPercent,\n\t\tWindowSeconds: windowSeconds,\n\t}\n\n\tif resetRaw != \"\" {\n\t\tresetAt, err := parseClaudeUsageResetTime(resetRaw, now)\n\t\tif err == nil {\n\t\t\tresetAfter := int(resetAt.Sub(now).Round(time.Second).Seconds())\n\t\t\tif resetAfter < 0 {\n\t\t\t\tresetAfter = 0\n\t\t\t}\n\t\t\twindow.ResetAfterSeconds = resetAfter\n\t\t\twindow.ResetAtUnix = resetAt.Unix()\n\t\t}","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/claudecode/claude_usage.go#L357-L393","documentation":"A parse guard in parseClaudeUsageWindow: the section header was found, but no line inside the block matched the usage-percentage regex. It fires when the block is present but its content layout differs from expectations (format change or truncated capture).","triggerScenarios":"Thrown at agent/claudecode/claude_usage.go:375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Update Claude Code and cc-connect to matching versions","Inspect the captured block content to see what replaced the percentage line","Retry once in case of a partially rendered screen"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}