diff --git a/internal/gapicgen/gensnippets/gensnippets.go b/internal/gapicgen/gensnippets/gensnippets.go index aa0f868ec2c1..03eb40df64a3 100644 --- a/internal/gapicgen/gensnippets/gensnippets.go +++ b/internal/gapicgen/gensnippets/gensnippets.go @@ -133,6 +133,11 @@ func processExamples(pkg *doc.Package, fset *token.FileSet, trimPrefix, rootDir, if err != nil { return []error{err} } + if apiInfo == nil { + // There was no gapic_metadata.json, skip processing examples for + // non gapic lib. + return nil + } regionTags := apiInfo.RegionTags() if len(regionTags) == 0 {