{"record":{"id":"b8e8f06354d80abf","repo":"OpenNHP/opennhp","slug":"relay-server-q-invalid-publickeybase64-w","errorCode":null,"errorMessage":"relay: server %q invalid publicKeyBase64: %w","messagePattern":"relay: server %q invalid publicKeyBase64: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"endpoints/relay/relay.go","lineNumber":257,"sourceCode":"\tlog.Info(\"[Relay] initialized, relay pubkey=%s, %d server(s)\",\n\t\tdevice.PublicKeyBase64(), len(rs.servers))\n\tfor _, cr := range rs.servers {\n\t\tlog.Info(\"[Relay]   server id=%s name=%q lb=%s instances=%d\",\n\t\t\tcr.id, cr.name, cr.scheme, len(cr.instances))\n\t\tfor _, inst := range cr.instances {\n\t\t\tlog.Info(\"[Relay]     upstream %s:%d (weight=%d)\",\n\t\t\t\tinst.host, inst.port, inst.weight)\n\t\t}\n\t}\n\treturn rs, nil\n}\n\n// buildServer turns a config Server into runtime state, registering each\n// instance as a peer on the NHP device.\nfunc (rs *RelayServer) buildServer(c *Server) (*serverRuntime, error) {\n\tpubKey, err := base64.StdEncoding.DecodeString(c.PubKeyBase64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"relay: server %q invalid publicKeyBase64: %w\", c.Name, err)\n\t}\n\tid := utils.PubKeyFingerprint(pubKey)\n\n\tsticky := false // default: per-request load balancing\n\tif c.StickyInstance != nil {\n\t\tsticky = *c.StickyInstance\n\t}\n\tcr := &serverRuntime{\n\t\tid:           id,\n\t\tname:         c.Name,\n\t\tpubKey:       pubKey,\n\t\tpubKeyBase64: c.PubKeyBase64,\n\t\tscheme:       c.LoadBalance,\n\t\tsticky:       sticky,\n\t\tinstances:    make([]*serverInstance, 0, len(c.Instances)),\n\t}\n\n\tfor j := range c.Instances {","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/endpoints/relay/relay.go#L239-L275","documentation":"Raised in RelayServer.buildServer while converting a configured [[Servers]] entry into runtime state: decoding that server's PubKeyBase64 with standard base64 failed. The peer public key copied into the relay config for this upstream NHP server is malformed or was pasted in the wrong encoding.","triggerScenarios":"Thrown at endpoints/relay/relay.go:257 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-copy the server's public key from its config or keygen output into the relay config","Remove surrounding whitespace/newlines introduced during copy-paste","Confirm standard (not URL-safe) base64 is used"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}