{"record":{"id":"71b996cc951fa666","repo":"ory/kratos","slug":"unable-to-parse-text-directory","errorCode":null,"errorMessage":"unable to parse text directory","messagePattern":"unable to parse text directory","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/clidoc/main.go","lineNumber":346,"sourceCode":"\t}\n\n\tif err := f.Close(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc validateAllMessages(path string) error {\n\ttype message struct {\n\t\tID, Name string\n\t}\n\n\tusedIDs := make([]message, 0, len(messages))\n\tset := token.NewFileSet()\n\tpacks, err := parser.ParseDir(set, path, nil, 0)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to parse text directory\")\n\t}\n\tinfo := &types.Info{\n\t\tDefs: make(map[*ast.Ident]types.Object),\n\t}\n\n\t//nolint:staticcheck\n\tvar pack *ast.Package\n\tfor _, p := range packs {\n\t\tif p.Name == \"text\" {\n\t\t\tpack = p\n\t\t\tbreak\n\t\t}\n\t}\n\tallFiles := make([]*ast.File, 0)\n\tfor fn, f := range pack.Files {\n\t\tif strings.HasSuffix(fn, \"/id.go\") {\n\t\t\tallFiles = append(allFiles, f)\n\t\t}","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/ory/kratos/blob/b86338da04a040247a07f46100a86dcfb3875909/cmd/clidoc/main.go#L328-L364","documentation":"During documentation generation, go/parser.ParseDir failed to parse the Go sources in the messages text package directory. The underlying error is wrapped, meaning one or more files in that directory have syntax errors or cannot be read; this is a build-time failure of the clidoc tool, not a runtime user error.","triggerScenarios":"Thrown at cmd/clidoc/main.go:346 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the path passed to validateAllMessages points to the text package directory and exists before parsing","Ensure the directory contains only valid Go source files; move stray non-Go files elsewhere","Check for syntax errors in the .go files under the text directory with go build or go vet","Confirm the process has read permission on the directory","Pass a cleaned absolute path (e.g. via filepath.Abs) to avoid relative-path resolution issues"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b86338da04a040247a07f46100a86dcfb3875909","analyzedAt":"2026-09-07T15:58:15.934Z","contentChangedAt":"2026-09-07T15:58:15.934Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}