fatedier/frp · error

invalid visitor config

Error message

invalid visitor config

What it means

validateStoreVisitorConfigurer rejects a nil VisitorConfigurer before validation. Reached from CreateStoreVisitor/UpdateStoreVisitor when the decoded body has no usable visitor config — usually an unknown visitor type string. The caller sees 'invalid argument: validation error: invalid visitor config' (or the create-path equivalent).

Source

Thrown at client/config_manager.go:456

	}
	return persisted.Clone(), nil
}

func (m *serviceConfigManager) validateStoreProxyConfigurer(cfg v1.ProxyConfigurer) error {
	if cfg == nil {
		return fmt.Errorf("invalid proxy config")
	}
	runtimeCfg := cfg.Clone()
	if runtimeCfg == nil {
		return fmt.Errorf("invalid proxy config")
	}
	runtimeCfg.Complete()
	return validation.ValidateProxyConfigurerForClient(runtimeCfg)
}

func (m *serviceConfigManager) validateStoreVisitorConfigurer(cfg v1.VisitorConfigurer) error {
	if cfg == nil {
		return fmt.Errorf("invalid visitor config")
	}
	runtimeCfg := cfg.Clone()
	if runtimeCfg == nil {
		return fmt.Errorf("invalid visitor config")
	}
	runtimeCfg.Complete()
	return validation.ValidateVisitorConfigurer(runtimeCfg)
}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Use a valid visitor type: stcp, xtcp, or sudp
  2. Include the base fields: name, bindPort, and the secretKey/serverName as required
  3. Verify frpc version supports the visitor type

Example fix

// before
{"type": "tcp", "name": "v1"}

// after
{"type": "stcp", "name": "v1", "serverName": "svc", "secretKey": "k", "bindPort": 6000}
Defensive patterns

Strategy: type-guard

Validate before calling

func knownVisitorType(t string) bool {
	switch t {
	case "stcp", "xtcp", "sudp":
		return true
	}
	return false
}

Type guard

func isValidVisitorBody(body []byte) bool {
	var v struct{ Type string `json:"type"` }
	if json.Unmarshal(body, &v) != nil {
		return false
	}
	return knownVisitorType(v.Type)
}

Prevention

When it happens

Trigger: POST/PUT /api/config/visitors with a type the decoder does not recognize (valid: stcp, xtcp, sudp) or an empty body.

Common situations: Sending 'tcp' (a proxy type) as a visitor type; typos; using a visitor type added in a newer frp version than the running client.

Related errors


AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15). Data as JSON: /api/errors/d1c5ffa6a575d01b. Report an issue: GitHub.