{"record":{"id":"e94ff602636c4be0","repo":"charmbracelet/glow","slug":"missing-markdown-source","errorCode":null,"errorMessage":"missing markdown source","messagePattern":"missing markdown source","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":138,"sourceCode":"\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tu, _ := filepath.Abs(path)\n\t\t\t\t\tsrc = &source{r, u}\n\n\t\t\t\t\t// abort filepath.Walk\n\t\t\t\t\treturn errors.New(\"source found\")\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif src != nil {\n\t\t\treturn src, nil\n\t\t}\n\n\t\treturn nil, errors.New(\"missing markdown source\")\n\t}\n\n\tr, err := os.Open(arg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open file: %w\", err)\n\t}\n\tu, err := filepath.Abs(arg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get absolute path: %w\", err)\n\t}\n\treturn &source{r, u}, nil\n}\n\n// validateStyle checks if the style is a default style, if not, checks that\n// the custom style exists.\nfunc validateStyle(style string) error {\n\tif style != \"auto\" && styles.DefaultStyles[style] == nil {\n\t\tstyle = utils.ExpandPath(style)","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/charmbracelet/glow/blob/e3970c813d93da1ea84edfca90c289d9afb82242/main.go#L120-L156","documentation":"When its argument is a directory (or empty, defaulting to \".\"), glow walks the tree via filepath.Walk looking for a base name equal (case-insensitively) to one of readmeNames: README.md, README, Readme.md, Readme, readme.md, readme. If no file with one of those exact names is readable, src stays nil and this error is returned. Note it matches only those six names, not *.md in general.","triggerScenarios":"Running glow (or glow with a directory argument) in a tree containing index.md, NOTES.md, README.markdown, or ReadMe.md — none of which are in the list; a README that exists but fails os.Open on every candidate due to permissions (the walk continues, src stays nil); passing a path to an empty or wrong directory.","commonSituations":"Running glow inside docs/ or a notes folder that has no README; repos using the older README.markdown convention; mixed-case variants like ReadMe.md; file permissions (chmod 000) on the README under a root-owned directory.","solutions":["Pass the markdown file explicitly: glow NOTES.md","Rename or symlink your main doc to README.md (the first entry checked in readmeNames)","If a README exists, verify it is readable (ls -l, cat) and matches one of the six accepted names exactly","Run glow from the directory that actually contains the README"],"exampleFix":"# before: docs/ contains only index.md\nglow docs/\n\n# after: point glow at the file\nglow docs/index.md\n# or: mv docs/index.md docs/README.md && glow docs/","handlingStrategy":"validation","validationCode":"var readmeNames = []string{\"README.md\", \"README\", \"Readme.md\", \"Readme\", \"readme.md\", \"readme\"}\n\nfunc hasReadableReadme(dir string) bool {\n\tfound := false\n\t_ = filepath.Walk(dir, func(p string, info os.FileInfo, err error) error {\n\t\tif err != nil || info.IsDir() {\n\t\treturn nil\n\t\t}\n\t\tfor _, n := range readmeNames {\n\t\t\tif strings.EqualFold(filepath.Base(p), n) {\n\t\t\tfound = true\n\t\t\treturn filepath.SkipAll\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn found\n}\n\nif !hasReadableReadme(dir) {\n\t// pass the explicit file instead of the directory\n\targ = filepath.Join(dir, \"index.md\")\n}","typeGuard":null,"tryCatchPattern":"src, err := openSource(arg)\nif err != nil {\n\tif err.Error() == \"missing markdown source\" {\n\t\t// directory had no README-named file; pick a specific markdown file\n\t\treturn openSource(filepath.Join(arg, \"index.md\"))\n\t}\n\treturn err\n}","preventionTips":["In scripts, always pass an explicit file path rather than relying on directory discovery","Name your entry document README.md — the first pattern glow checks","Remember the accepted set is exactly six names; README.markdown and *.md in general do not match"],"tags":["filesystem","readme","directory-walk","cli"],"backgroundTag":null,"analyzedSha":"e3970c813d93da1ea84edfca90c289d9afb82242","analyzedAt":"2026-08-15T22:50:54.304Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}