{"record":{"id":"9f8a6a543b202eee","repo":"shadow1ng/fscan","slug":"webscan-nuclei-format-parse-failed","errorCode":"webscan_nuclei_format_parse_failed","errorMessage":"webscan_nuclei_format_parse_failed: %w","messagePattern":"webscan_nuclei_format_parse_failed: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"webscan/lib/poc_adapter.go","lineNumber":207,"sourceCode":"type NucleiMatcher struct {\n\tType      string   `yaml:\"type\"`\n\tWords     []string `yaml:\"words\"`\n\tStatus    []int    `yaml:\"status\"`\n\tRegex     []string `yaml:\"regex\"`\n\tCondition string   `yaml:\"condition\"`\n\tPart      string   `yaml:\"part\"`\n\tNegative  bool     `yaml:\"negative\"`\n}\n\n// NucleiPocAdapter Nuclei格式适配器\ntype NucleiPocAdapter struct {\n\t*NucleiPoc\n}\n\nfunc loadNucleiPoc(data []byte) (*NucleiPocAdapter, error) {\n\tvar poc NucleiPoc\n\tif err := yaml.Unmarshal(data, &poc); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", i18n.GetText(\"webscan_nuclei_format_parse_failed\"), err)\n\t}\n\treturn &NucleiPocAdapter{&poc}, nil\n}\n\n// GetName 获取POC名称（优先使用Info.Name，否则使用ID）\nfunc (n *NucleiPocAdapter) GetName() string {\n\tif n.Info.Name != \"\" {\n\t\treturn n.Info.Name\n\t}\n\treturn n.ID\n}\n\n// GetFormat 获取POC格式类型\nfunc (n *NucleiPocAdapter) GetFormat() PocFormat {\n\treturn FormatNuclei\n}\n\n// ToFscanPoc 将Nuclei格式转换为fscan格式","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/webscan/lib/poc_adapter.go#L189-L225","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Unwrap the error to see the exact yaml line/column and fix the syntax or type there.","Match info/metadata shapes to what NucleiPocAdapter accepts (tests cover scalar and list metadata — use one of those forms).","Downgrade or rewrite templates that use newer nuclei schema features the adapter lacks.","Validate the template with the official nuclei tool first to isolate YAML syntax from adapter-specific mismatches."],"exampleFix":"// before\n// info:\n//   name: test\n//   classification: not-a-mapping  <- wrong type for struct\n\n// after\n// info:\n//   name: test\n//   severity: high\n//   tags: cve","handlingStrategy":"validation","validationCode":"var probe struct {\n    Info map[string]interface{} `yaml:\"info\"`\n    HTTP []map[string]interface{} `yaml:\"http\"`\n}\nif err := yaml.Unmarshal(data, &probe); err != nil {\n    return fmt.Errorf(\"not a parseable nuclei template: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"poc, err := loadNucleiPoc(data)\nif err != nil {\n    return fmt.Errorf(\"nuclei template parse: %w\", err)\n}","preventionTips":["Pin nuclei template versions to features the adapter's NucleiPoc struct supports.","Use scalar or list metadata forms matching what NucleiPocAdapter accepts.","Lint templates with yaml/nuclei tooling before bulk conversion."],"tags":["poc","yaml","unmarshal","nuclei"],"backgroundTag":"yaml-parse-error","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}