{"record":{"id":"e5e8168be693ba47","repo":"golang/go","slug":"invalid-time-from-git-log-q","errorCode":null,"errorMessage":"invalid time from git log: %q","messagePattern":"invalid time from git log: %q","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/codehost/git.go","lineNumber":665,"sourceCode":"\tif err != nil {\n\t\t// Return info with Origin.RepoSum if possible to allow caching of negative lookup.\n\t\tvar info *RevInfo\n\t\tif refs, err := r.loadRefs(ctx); err == nil {\n\t\t\tinfo = r.unknownRevisionInfo(refs)\n\t\t}\n\t\treturn info, &UnknownRevisionError{Rev: rev}\n\t}\n\tf := strings.Fields(string(out))\n\tif len(f) < 2 {\n\t\treturn nil, fmt.Errorf(\"unexpected response from git log: %q\", out)\n\t}\n\thash := f[0]\n\tif strings.HasPrefix(hash, version) {\n\t\tversion = hash // extend to full hash\n\t}\n\tt, err := strconv.ParseInt(f[1], 10, 64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid time from git log: %q\", out)\n\t}\n\n\tinfo := &RevInfo{\n\t\tOrigin: &Origin{\n\t\t\tVCS:  \"git\",\n\t\t\tURL:  r.remoteURL,\n\t\t\tHash: hash,\n\t\t},\n\t\tName:    hash,\n\t\tShort:   r.shortenObjectHash(hash),\n\t\tTime:    time.Unix(t, 0).UTC(),\n\t\tVersion: hash,\n\t}\n\tif !strings.HasPrefix(hash, rev) {\n\t\tinfo.Origin.Ref = rev\n\t}\n\n\t// Add tags. Output looks like:","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/codehost/git.go#L647-L683","documentation":"Thrown by gitRepo.statLocal when the commit-timestamp field (f[1], expected to be a Unix epoch integer from %ct) fails strconv.ParseInt. The %q includes the full raw git log output for diagnosis. This means git returned a recognizable first field (hash) but the second field is not a parseable integer.","triggerScenarios":"statLocal parses 'git log --format=%H %ct %D' output; f[1] should be the commit time as seconds-since-epoch. If git emits garbage, an empty string, or a localized/non-numeric value where the timestamp should be, ParseInt fails.","commonSituations":"Corrupted git object database producing garbage metadata; a custom git build or wrapper altering output format; locale issues (unlikely with %ct which is always numeric); partial object files from an interrupted operation.","solutions":["Clear the VCS cache: 'go clean -cache'.","Run 'git fsck --full' on the affected cached repo to detect object corruption.","Reinstall or upgrade git to rule out a binary bug.","Check for and remove any git wrappers/aliases that alter log output."],"exampleFix":"# before: cache has corrupted commit objects\ngo mod download example.com/mod\n# invalid time from git log: \"abc123 1523994202\"\n# after\ngo clean -cache\ngo mod download example.com/mod","handlingStrategy":"fallback","validationCode":"null","typeGuard":"null","tryCatchPattern":"// On unparseable git timestamp, clear cache and retry\ninfo, err := repo.Stat(ctx, rev)\nif err != nil && strings.Contains(err.Error(), \"invalid time from git log\") {\n    os.RemoveAll(filepath.Join(gomodcache, \"cache/vcs\"))\n    info, err = repo.Stat(ctx, rev)\n}\nreturn info, err","preventionTips":["Treat 'invalid time from git log' as a corruption signal; clear the cache.","Run 'git fsck --full' on cached repos to detect object damage early.","Avoid interrupting 'go get' / 'go mod download' mid-clone.","Keep git updated to avoid known output-format bugs."],"tags":["git","malformed-output","corruption","stat-local","parse-error","internal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}