ory/kratos · error
expected to find message
Error message
expected to find message %s in the list for the documentation generation but could not
What it means
The clidoc generator walked the text package and found an exported constructor function starting with 'New' that is not present in the generator's messages map. The messages registry and the actual source have drifted apart, so documentation cannot be generated for that message.
Solutions
- Add the missing message to the messages list in cmd/clidoc/main.go with its ID and name
- If the constructor was renamed or removed on purpose, update the messages list to match
- Regenerate the documentation afterwards to confirm the error is gone
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/clidoc/main.go:377 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ory/kratos@b86338da04 (2026-09-07).
Data as JSON: /api/errors/96c3a00a4b83a2a1.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/clidoc/main.go:377
}
allFiles := make([]*ast.File, 0)
for fn, f := range pack.Files {
if strings.HasSuffix(fn, "/id.go") {
allFiles = append(allFiles, f)
}
}
_, err = (&types.Config{Importer: importer.Default()}).Check("text", set, allFiles, info)
if err != nil {
return err // type error
}
for _, f := range pack.Files {
for _, d := range f.Decls {
switch decl := d.(type) {
case *ast.FuncDecl:
if name := decl.Name.String(); decl.Name.IsExported() && strings.HasPrefix(name, "New") {
if _, ok := messages[name]; !ok {
return errors.Errorf("expected to find message %s in the list for the documentation generation but could not", name)
}
}
case *ast.GenDecl:
if decl.Tok == token.CONST {
for _, spec := range decl.Specs {
value := spec.(*ast.ValueSpec) // safe because decl.Tok is token.CONST
if t, ok := value.Type.(*ast.Ident); ok {
if t.Name == "ID" {
for _, name := range value.Names {
c := info.ObjectOf(name)
if c == nil {
return errors.Errorf("expected to find const %s in text/id.go", name.Name)
}
usedIDs = append(usedIDs, message{
ID: c.(*types.Const).Val().ExactString(),
Name: name.Name,
})
}View on GitHub (pinned to b86338da04)