fatedier/frp · error
type [%s] error
Error message
type [%s] error
What it means
After confirming the visitor type is non-empty, NewVisitorConfFromIni calls DefaultVisitorConf; if the type is not one of stcp, sudp, xtcp it returns nil and this 'type [<type>] error' is thrown. Only the secret/p2p visitor families are supported.
Source
Thrown at pkg/config/legacy/visitor.go:178
}
if cfg.FallbackTimeoutMs <= 0 {
cfg.FallbackTimeoutMs = 1000
}
return
}
// Visitor loaded from ini
func NewVisitorConfFromIni(prefix string, name string, section *ini.Section) (VisitorConf, error) {
// section.Key: if key not exists, section will set it with default value.
visitorType := VisitorType(section.Key("type").String())
if visitorType == "" {
return nil, fmt.Errorf("type shouldn't be empty")
}
conf := DefaultVisitorConf(visitorType)
if conf == nil {
return nil, fmt.Errorf("type [%s] error", visitorType)
}
if err := conf.UnmarshalFromIni(prefix, name, section); err != nil {
return nil, fmt.Errorf("type [%s] error", visitorType)
}
return conf, nil
}
View on GitHub (pinned to 6c8a8d0a97)
Solutions
- Change type to stcp, sudp, or xtcp depending on the paired proxy
- Ensure the matching proxy on the other side uses the same family (stcp<->stcp, sudp<->sudp, xtcp<->xtcp)
- Set the correct serverName/sk fields for the chosen visitor type
Example fix
# before [secret-visitor] type = tcp # after [secret-visitor] type = stcp
Defensive patterns
Strategy: type-guard
Validate before calling
validVisitors := map[string]bool{"stcp":true,"sudp":true,"xtcp":true}
if !validVisitors[visitorType] {
return fmt.Errorf("visitor type %q unsupported; use stcp/sudp/xtcp", visitorType)
} Type guard
func isValidVisitorType(t string) bool {
switch t {
case "stcp", "sudp", "xtcp":
return true
}
return false
} Try / catch
if _, err := legacy.NewVisitorConfFromIni(prefix, name, section); err != nil && strings.HasPrefix(err.Error(), "type [") { /* map type to visitor family */ } Prevention
- Remember visitors exist only for the secret/p2p families
- Pair visitor type with the proxy's type
- Keep a cheat-sheet of proxy-vs-visitor type sets
When it happens
Trigger: A visitor section with type = tcp, type = http, or any value other than stcp/sudp/xtcp. Common when users assume any proxy type can be 'visited'.
Common situations: Trying to expose a plain tcp proxy's service via a visitor section; misreading docs and putting the underlying proxy type instead of the visitor type.
Related errors
- type shouldn't be empty
- name is required
- server name is required
- bind port is required
- invalid heartbeat_timeout, heartbeat_timeout is less than he
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/2056d8e9ed3a995f.
Report an issue: GitHub.