{"record":{"id":"b2ac63ebb2fbbc6d","repo":"XTLS/Xray-core","slug":"api-tag-can-t-be-empty","errorCode":null,"errorMessage":"API tag can't be empty.","messagePattern":"API tag can't be empty\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/api.go","lineNumber":24,"sourceCode":"\t\"github.com/xtls/xray-core/app/commander\"\n\tloggerservice \"github.com/xtls/xray-core/app/log/command\"\n\tobservatoryservice \"github.com/xtls/xray-core/app/observatory/command\"\n\thandlerservice \"github.com/xtls/xray-core/app/proxyman/command\"\n\trouterservice \"github.com/xtls/xray-core/app/router/command\"\n\tstatsservice \"github.com/xtls/xray-core/app/stats/command\"\n\t\"github.com/xtls/xray-core/common/errors\"\n\t\"github.com/xtls/xray-core/common/serial\"\n)\n\ntype APIConfig struct {\n\tTag      string   `json:\"tag\"`\n\tListen   string   `json:\"listen\"`\n\tServices []string `json:\"services\"`\n}\n\nfunc (c *APIConfig) Build() (*commander.Config, error) {\n\tif c.Tag == \"\" {\n\t\treturn nil, errors.New(\"API tag can't be empty.\")\n\t}\n\n\tservices := make([]*serial.TypedMessage, 0, 16)\n\tfor _, s := range c.Services {\n\t\tswitch strings.ToLower(s) {\n\t\tcase \"reflectionservice\":\n\t\t\tservices = append(services, serial.ToTypedMessage(&commander.ReflectionConfig{}))\n\t\tcase \"handlerservice\":\n\t\t\tservices = append(services, serial.ToTypedMessage(&handlerservice.Config{}))\n\t\tcase \"loggerservice\":\n\t\t\tservices = append(services, serial.ToTypedMessage(&loggerservice.Config{}))\n\t\tcase \"statsservice\":\n\t\t\tservices = append(services, serial.ToTypedMessage(&statsservice.Config{}))\n\t\tcase \"observatoryservice\":\n\t\t\tservices = append(services, serial.ToTypedMessage(&observatoryservice.Config{}))\n\t\tcase \"routingservice\":\n\t\t\tservices = append(services, serial.ToTypedMessage(&routerservice.Config{}))\n\t\t}","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/api.go#L6-L42","documentation":"Error \"API tag can't be empty.\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at infra/conf/api.go:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}