shadow1ng/fscan · error

webscan_nuclei_format_parse_failed

webscan_nuclei_format_parse_failed

Error message

webscan_nuclei_format_parse_failed: %w

What it means

loadNucleiPoc unmarshals nuclei-format POC bytes into the NucleiPoc struct with yaml.Unmarshal. Any YAML syntax or schema mismatch is wrapped as webscan_nuclei_format_parse_failed. Nuclei POCs carry nested Info/Rules structures, so subtle type mismatches commonly trigger this.

Source

Thrown at webscan/lib/poc_adapter.go:207

type NucleiMatcher struct {
	Type      string   `yaml:"type"`
	Words     []string `yaml:"words"`
	Status    []int    `yaml:"status"`
	Regex     []string `yaml:"regex"`
	Condition string   `yaml:"condition"`
	Part      string   `yaml:"part"`
	Negative  bool     `yaml:"negative"`
}

// NucleiPocAdapter Nuclei格式适配器
type NucleiPocAdapter struct {
	*NucleiPoc
}

func loadNucleiPoc(data []byte) (*NucleiPocAdapter, error) {
	var poc NucleiPoc
	if err := yaml.Unmarshal(data, &poc); err != nil {
		return nil, fmt.Errorf("%s: %w", i18n.GetText("webscan_nuclei_format_parse_failed"), err)
	}
	return &NucleiPocAdapter{&poc}, nil
}

// GetName 获取POC名称(优先使用Info.Name,否则使用ID)
func (n *NucleiPocAdapter) GetName() string {
	if n.Info.Name != "" {
		return n.Info.Name
	}
	return n.ID
}

// GetFormat 获取POC格式类型
func (n *NucleiPocAdapter) GetFormat() PocFormat {
	return FormatNuclei
}

// ToFscanPoc 将Nuclei格式转换为fscan格式

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Unwrap the error to see the exact yaml line/column and fix the syntax or type there.
  2. Match info/metadata shapes to what NucleiPocAdapter accepts (tests cover scalar and list metadata — use one of those forms).
  3. Downgrade or rewrite templates that use newer nuclei schema features the adapter lacks.
  4. Validate the template with the official nuclei tool first to isolate YAML syntax from adapter-specific mismatches.

Example fix

// before
// info:
//   name: test
//   classification: not-a-mapping  <- wrong type for struct

// after
// info:
//   name: test
//   severity: high
//   tags: cve
Defensive patterns

Strategy: validation

Validate before calling

var probe struct {
    Info map[string]interface{} `yaml:"info"`
    HTTP []map[string]interface{} `yaml:"http"`
}
if err := yaml.Unmarshal(data, &probe); err != nil {
    return fmt.Errorf("not a parseable nuclei template: %w", err)
}

Try / catch

poc, err := loadNucleiPoc(data)
if err != nil {
    return fmt.Errorf("nuclei template parse: %w", err)
}

Prevention

When it happens

Trigger: LoadUniversalPoc detects FormatNuclei and yaml.Unmarshal fails: invalid YAML, info/metadata fields typed differently than the NucleiPoc struct expects (e.g., scalar vs list), http block fields with wrong types, tabs instead of spaces.

Common situations: Using nuclei templates from a newer nuclei version with fields the adapter's struct doesn't know; metadata blocks mixing scalar and list forms; hand-edited templates with syntax mistakes.

Related errors


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/9f8a6a543b202eee. Report an issue: GitHub.