projectdiscovery/nuclei · error

imported-file content count does not match imported-file pat

Error message

imported-file content count does not match imported-file path count

What it means

Error "imported-file content count does not match imported-file path count" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/templates/signer/tmpl_signer.go:215

	content = normalizeTemplateContentForSignature(content)

	buff, err := templateContentWithImports(content, tmpl)
	if err != nil {
		return false, err
	}

	return t.verify(buff.Bytes(), digest)
}

func templateContentWithImports(content []byte, tmpl SignableTemplate) (*bytes.Buffer, error) {
	buff := bytes.NewBuffer(content)
	imports := tmpl.GetFileImports()

	if provider, ok := tmpl.(fileImportContentProvider); ok {
		if importedContents, captured := provider.GetFileImportContents(); captured {
			if len(importedContents) != len(imports) {
				return nil, fmt.Errorf("imported-file content count does not match imported-file path count")
			}

			for _, importedContent := range importedContents {
				buff.WriteRune('\n')
				buff.Write(importedContent)
			}

			return buff, nil
		}
	}

	for _, file := range imports {
		bin, err := os.ReadFile(file)
		if err != nil {
			return nil, err
		}

		buff.WriteRune('\n')

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/templates/signer/tmpl_signer.go:215 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/8bc938928ce37df9. Report an issue: GitHub.