{"record":{"id":"1c50d2ad6cc0e25b","repo":"XTLS/Xray-core","slug":"cannot-get-depended-features","errorCode":null,"errorMessage":"Cannot get depended features","messagePattern":"Cannot get depended features","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"app/observatory/burst/burstobserver.go","lineNumber":100,"sourceCode":"}\n\nfunc (o *Observer) Close() error {\n\tif o.finished != nil {\n\t\to.hp.StopScheduler()\n\t\treturn o.finished.Close()\n\t}\n\treturn nil\n}\n\nfunc New(ctx context.Context, config *Config) (*Observer, error) {\n\tvar outboundManager outbound.Manager\n\tvar dispatcher routing.Dispatcher\n\terr := core.RequireFeatures(ctx, func(om outbound.Manager, rd routing.Dispatcher) {\n\t\toutboundManager = om\n\t\tdispatcher = rd\n\t})\n\tif err != nil {\n\t\treturn nil, errors.New(\"Cannot get depended features\").Base(err)\n\t}\n\thp := NewHealthPing(ctx, dispatcher, config.PingConfig)\n\treturn &Observer{\n\t\tconfig: config,\n\t\tctx:    ctx,\n\t\tohm:    outboundManager,\n\t\thp:     hp,\n\t}, nil\n}\n\nfunc init() {\n\tcommon.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {\n\t\treturn New(ctx, config.(*Config))\n\t}))\n}\n","sourceCodeStart":82,"sourceCodeEnd":116,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/app/observatory/burst/burstobserver.go#L82-L116","documentation":"Returned by New() for the burst observatory (app/observatory/burst/burstobserver.go:100) when core.RequireFeatures fails to resolve the outbound.Manager and routing.Dispatcher features from the instance context. The burst observer needs the dispatcher to send probe connections and the outbound manager to enumerate/select outbounds; if either feature is not registered in the core instance, the observer cannot be constructed.","triggerScenarios":"Creating a burst Observatory whose inbound/outbound dependencies are unsatisfiable — typically when the app is registered on a core.Instance built without the proxyman app (which provides both outbound.Manager and routing.Dispatcher), or when feature resolution order fails because dependencies are started in the wrong phase.","commonSituations":"Embedding xray-core as a library and building a minimal core.Instance with an app list that includes burst observatory but omits proxyman; or a config where the observatory is loaded in an unusual feature-registration order. Rarely seen in normal full JSON configs because proxyman is always present.","solutions":["Ensure the core instance registers the proxyman app (app/proxyman/commander style setup) so outbound.Manager and routing.Dispatcher exist — in JSON configs this is automatic.","If embedding programmatically, append app/proxyman.Manager to core.Config.App before core.New().","Check the returned cause (err) via Base() — it usually says which feature type was missing.","Verify the burst observatory config block is inside the same instance as the outbounds it observes."],"exampleFix":"// before\ncfg := &core.Config{App: []serial.Message{&burst.Config{ ... }}}\ninst, err := core.New(cfg)\n\n// after — include proxyman so required features resolve\ncfg := &core.Config{App: []serial.Message{\n  &proxyman.Config{},\n  &burst.Config{ ... },\n}}\ninst, err := core.New(cfg)","handlingStrategy":"validation","validationCode":"// when embedding: ensure proxyman is registered before burst observatory\nhasProxyman := false\nfor _, m := range cfg.App {\n    if strings.Contains(m.TypeUrl, \"app.proxyman\") { hasProxyman = true }\n}\nif !hasProxyman && usesBurstObservatory(cfg) {\n    return fmt.Errorf(\"burst observatory requires proxyman features\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := burst.New(ctx, bcfg); err != nil {\n    return fmt.Errorf(\"burst observer init failed: %w\", err) // inspect Base for missing feature\n}","preventionTips":["Include app/proxyman in any instance that loads observatory apps.","Test minimal embedded instances for feature-resolution errors at startup, not in production paths."],"tags":["go","xray","dependency-injection","configuration"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}