diff --git a/pkg/yang/entry.go b/pkg/yang/entry.go index 97cce31..77d0964 100644 --- a/pkg/yang/entry.go +++ b/pkg/yang/entry.go @@ -1322,11 +1322,17 @@ func (e *Entry) Find(name string) *Entry { e = e.Parent } if prefix, _ := getPrefix(parts[0]); prefix != "" { - m := module(FindModuleByPrefix(contextNode, prefix)) - if m == nil { + mod := FindModuleByPrefix(contextNode, prefix) + if mod == nil { e.addError(fmt.Errorf("cannot find module giving prefix %q within context entry %q", prefix, e.Path())) return nil } + m := module(mod) + if m == nil { + e.addError(fmt.Errorf("cannot find which module %q belongs to within context entry %q", + mod.NName(), e.Path())) + return nil + } if m != e.Node.(*Module) { e = ToEntry(m) }