snail007/goproxy · error

service not found

Error message

service %s not found

What it means

Run starts a configured service by looking up its type name in the registered service map. This fatal-path error is returned when the requested service name is not registered in the map, i.e. the config requested a service type the binary does not know.

Solutions

  1. Check the service name in the config against the documented list of supported service types and fix the typo
  2. Upgrade to a binary version that supports the requested service type
  3. Confirm which service types the running build registers (see the services map in services/service.go)
  4. Enable the corresponding config option that registers the service if it is opt-in

Example fix

// before (typo in config)
// mode=httpproxyx
// after
// mode=httpProxy  (a name registered in the services map)
Defensive patterns

Strategy: validation

Validate before calling

var supportedServices = map[string]bool{"httpProxy": true, "tcp": true, "udp": true /* ...per docs */}
if !supportedServices[cfg.Mode] {
    return fmt.Errorf("config mode %q is not supported by this build", cfg.Mode)
}

Try / catch

if err := run(cfg); err != nil {
    if strings.Contains(err.Error(), "not found") && strings.Contains(err.Error(), "service") {
        log.Fatalf("unknown service type %q: check config against docs/binary version", cfg.Mode)
    }
}

Prevention

When it happens

Trigger: initConfig calls Run with a service name (from config, e.g. an unknown mode/type value) that has no entry in the services map; ok==false from the map lookup produces "service %s not found".

Common situations: Typo in the config's service/type field; running an older binary that lacks a newer service type; config copied from a different project/edition; case mismatch in the service name.

Related errors


AI-assisted analysis of snail007/goproxy@e6d6a821db (2026-09-03). Data as JSON: /api/errors/6638c8259b288bbc. Report an issue: GitHub.

Appendix: source

Thrown at services/service.go:45

}
func Run(name string) (service *ServiceItem, err error) {
	service, ok := servicesMap[name]
	if ok {
		go func() {
			defer func() {
				err := recover()
				if err != nil {
					log.Fatalf("%s servcie crashed, ERR: %s\ntrace:%s", name, err, string(debug.Stack()))
				}
			}()
			err := service.S.Start(service.Args)
			if err != nil {
				log.Fatalf("%s servcie fail, ERR: %s", name, err)
			}
		}()
	}
	if !ok {
		err = fmt.Errorf("service %s not found", name)
	}
	return
}

View on GitHub (pinned to e6d6a821db)