{"record":{"id":"f1b1570b40332511","repo":"XTLS/Xray-core","slug":"invalid-wireguard-secret-key-w","errorCode":null,"errorMessage":"invalid WireGuard secret key: %w","messagePattern":"invalid WireGuard secret key: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/wireguard.go","lineNumber":77,"sourceCode":"type WireGuardConfig struct {\n\tIsClient bool `json:\"\"`\n\n\tNoKernelTun    bool                   `json:\"noKernelTun\"`\n\tSecretKey      string                 `json:\"secretKey\"`\n\tAddress        []string               `json:\"address\"`\n\tPeers          []*WireGuardPeerConfig `json:\"peers\"`\n\tMTU            int32                  `json:\"mtu\"`\n\tReserved       []byte                 `json:\"reserved\"`\n\tDomainStrategy string                 `json:\"domainStrategy\"`\n}\n\nfunc (c *WireGuardConfig) Build() (proto.Message, error) {\n\tconfig := new(wireguard.DeviceConfig)\n\n\tvar err error\n\tconfig.SecretKey, err = ParseWireGuardKey(c.SecretKey)\n\tif err != nil {\n\t\treturn nil, errors.New(\"invalid WireGuard secret key: %w\", err)\n\t}\n\n\tif c.Address == nil {\n\t\t// bogon ips\n\t\tconfig.Endpoint = []string{\"10.0.0.1\", \"fd59:7153:2388:b5fd:0000:0000:0000:0001\"}\n\t} else {\n\t\tconfig.Endpoint = c.Address\n\t}\n\n\tif c.IsClient {\n\t\tconfig.Peers = make([]*wireguard.PeerConfig, len(c.Peers))\n\t\tfor i, p := range c.Peers {\n\t\t\tmsg, err := p.Build()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tconfig.Peers[i] = msg\n\t\t}","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/wireguard.go#L59-L95","documentation":"Error \"invalid WireGuard secret key: %w\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at infra/conf/wireguard.go:77 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"}