projectdiscovery/nuclei · error

failed to identify template format expected JSON or YAML but

Error message

failed to identify template format expected JSON or YAML but got %v

What it means

Error "failed to identify template format expected JSON or YAML but got %v" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/templates/parser.go:197

		}
	case config.YAML:
		if data != nil {
			// Already read and preprocessed
			if p.NoStrictSyntax {
				err = yamlutil.Unmarshal(data, template)
			} else {
				err = yamlutil.UnmarshalStrict(data, template)
			}
		} else {
			// Stream directly from reader
			decoder := yamlutil.NewDecoder(reader)
			if !p.NoStrictSyntax {
				decoder.SetStrict(true)
			}
			err = decoder.Decode(template)
		}
	default:
		err = fmt.Errorf("failed to identify template format expected JSON or YAML but got %v", templatePath)
	}
	if err != nil {
		return nil, err
	}

	p.parsedTemplatesCache.StoreWithoutRaw(templatePath, template, nil)

	return template, nil
}

// LoadWorkflow returns true if the workflow is valid and matches the filtering criteria.
func (p *Parser) LoadWorkflow(templatePath string, catalog catalog.Catalog) (bool, error) {
	t, templateParseError := p.ParseTemplate(templatePath, catalog)
	if templateParseError != nil {
		return false, templateParseError
	}

	template, ok := t.(*Template)

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/templates/parser.go:197 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/a2a199f486ceb5fe. Report an issue: GitHub.