shadow1ng/fscan · error

portfinger_probe_name_invalid

Error message

portfinger_probe_name_invalid

What it means

After validating the 4-byte protocol prefix, parseProbeInfo splits the remainder of the probe line via getDirectiveSyntax. If the directive name or the delimiter cannot be determined (empty DirectiveName or Delimiter), the line is not a valid probe directive and this error is returned.

Source

Thrown at core/portfinger/probe_parser.go:51

// parseProbeInfo 解析探测器信息,返回错误替代 panic
func (p *Probe) parseProbeInfo(probeStr string) error {
	if len(probeStr) < 5 {
		return fmt.Errorf("%s", i18n.GetText("portfinger_probe_protocol_invalid"))
	}

	// 提取协议和其他信息
	proto := probeStr[:4]
	other := probeStr[4:]

	// 验证协议类型
	if proto != "TCP " && proto != "UDP " {
		return fmt.Errorf("%s", i18n.GetText("portfinger_probe_protocol_invalid"))
	}

	// 验证其他信息不为空
	if len(other) == 0 {
		return fmt.Errorf("%s", i18n.GetText("portfinger_probe_name_invalid"))
	}

	// 解析指令
	directive := p.getDirectiveSyntax(other)
	if directive.DirectiveName == "" || directive.Delimiter == "" {
		return fmt.Errorf("%s", i18n.GetText("portfinger_probe_name_invalid"))
	}

	// 设置探测器属性
	p.Name = directive.DirectiveName
	p.Data = strings.Split(directive.DirectiveStr, directive.Delimiter)[0]
	p.Protocol = strings.ToLower(strings.TrimSpace(proto))

	return nil
}

// 从字符串解析探测器信息
func (p *Probe) fromString(data string) error {

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Ensure each probe line has a directive after the protocol prefix, e.g. "TCP ProbeName^payload".
  2. Check for truncated lines caused by file encoding or line-splitting issues (CRLF, cut-off files).
  3. Validate probe file content with a small test harness that calls fromString per line before deployment.
  4. Compare the line against a known-good probe database to spot missing payload/delimiter characters.

Example fix

// before
TCP 
// after
TCP ProbeName^data^end
Defensive patterns

Strategy: validation

Validate before calling

func hasDirective(line string) bool {
    rest := ""
    if strings.HasPrefix(line, "TCP ") { rest = line[4:] } else if strings.HasPrefix(line, "UDP ") { rest = line[4:] }
    return strings.TrimSpace(rest) != ""
}

Try / catch

probe, err := parser.FromString(data)
if err != nil && strings.Contains(err.Error(), "probe_name_invalid") {
    return fmt.Errorf("probe line missing directive: %w", err)
}

Prevention

When it happens

Trigger: A probe line has a valid "TCP "/"UDP " prefix but the rest of the line does not match the expected directive syntax (e.g. empty remainder handling, malformed directive without a recognizable name or delimiter), or getDirectiveSyntax fails after directive parsing. Also returned when the text after the protocol prefix is blank/whitespace-only (the len(other)==0 branch).

Common situations: Probe lines like "TCP " with nothing after it, lines truncated mid-directive, or copy-pasted probe lines that lost their payload after the protocol prefix.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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