shadow1ng/fscan · error

webscan_fscan_format_parse_failed

webscan_fscan_format_parse_failed

Error message

webscan_fscan_format_parse_failed: %w

What it means

loadFscanPoc unmarshals fscan-format POC bytes into the Poc struct with yaml.Unmarshal. On any YAML syntax or schema error the failure is wrapped as webscan_fscan_format_parse_failed. The adapter layer uses this so callers get a contextual message instead of a bare yaml error.

Source

Thrown at webscan/lib/poc_adapter.go:147

		return loadXrayPoc(data)
	case FormatAfrog:
		return loadAfrogPoc(data)
	default:
		return nil, fmt.Errorf("%s: %s", i18n.GetText("webscan_unknown_poc_format"), filename)
	}
}

// ============= fscan格式适配器 =============

// FscanPocAdapter fscan原生格式适配器
type FscanPocAdapter struct {
	*Poc
}

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

// GetName 获取POC名称
func (f *FscanPocAdapter) GetName() string {
	return f.Name
}

// GetFormat 获取POC格式类型
func (f *FscanPocAdapter) GetFormat() PocFormat {
	return FormatFscan
}

// ToFscanPoc 转换为Fscan POC格式
func (f *FscanPocAdapter) ToFscanPoc() (*Poc, error) {
	return f.Poc, nil
}

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Validate the YAML with a linter (yamllint) — fix indentation/tabs/syntax errors first.
  2. Compare field names/types against the Poc struct definition in poc_adapter.go and a known-good fscan POC.
  3. Run the file through yaml.Unmarshal in a scratch test to see the wrapped underlying error.
  4. Re-export or update the POC if it targets an older struct schema.

Example fix

// before
// rules:
//	- method: GET   <- tab indentation -> YAML parse error

// after
// rules:
//   - method: GET  <- spaces, valid YAML
Defensive patterns

Strategy: validation

Validate before calling

var probe map[string]interface{}
if err := yaml.Unmarshal(data, &probe); err != nil {
    return fmt.Errorf("invalid YAML: %w", err)
}

Try / catch

poc, err := loadFscanPoc(data)
if err != nil {
    return fmt.Errorf("fscan POC parse: %w", err)
}

Prevention

When it happens

Trigger: LoadUniversalPoc detects FormatFscan and the data fails yaml.Unmarshal: invalid YAML syntax, wrong types for Poc fields (e.g., string where int expected), duplicate keys, tabs for indentation.

Common situations: Hand-edited fscan POC files with indentation mistakes; POCs exported from other tools whose fields don't match the Poc struct; version changes where Poc struct fields were renamed or retyped.

Related errors


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