{"record":{"id":"3baa5135297e0ca8","repo":"OpenNHP/opennhp","slug":"master-key-is-not-set-please-execuute-setup-comma","errorCode":null,"errorMessage":"master key is not set, please execuute setup command first","messagePattern":"master key is not set, please execuute setup command first","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"endpoints/kgc/kgc.go","lineNumber":232,"sourceCode":"func NewKGCImplFromConfig() (*KGCImpl, error) {\n\tdirPath, err := GetExeDirPath()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfigFilePath := filepath.Join(dirPath, \"etc\", \"config.toml\")\n\tcontent, err := os.ReadFile(configFilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar config Config\n\tif unmarshalErr := toml.Unmarshal(content, &config); unmarshalErr != nil {\n\t\treturn nil, unmarshalErr\n\t}\n\n\tif config.MasterPrivateKeyBase64 == \"\" || config.MasterPublicKeyBase64 == \"\" {\n\t\treturn nil, fmt.Errorf(\"master key is not set, please execuute setup command first\")\n\t}\n\n\tmasterPrivateKey, err := base64.StdEncoding.DecodeString(config.MasterPrivateKeyBase64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmasterPublicKey, err := base64.StdEncoding.DecodeString(config.MasterPublicKeyBase64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config.DefaultCipherScheme == 0 {\n\t\tk := SM2.NewKGCImpl()\n\t\tk.masterKey = &MasterKey{\n\t\t\tMs:    new(big.Int).SetBytes(masterPrivateKey),\n\t\t\tPpubX: new(big.Int).SetBytes(masterPublicKey[0:32]),\n\t\t\tPpubY: new(big.Int).SetBytes(masterPublicKey[32:]),","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/endpoints/kgc/kgc.go#L214-L250","documentation":"Raised by NewKGCImplFromConfig after successfully reading and TOML-parsing etc/config.toml next to the executable: the MasterPrivateKeyBase64 or MasterPublicKeyBase64 field (or both) is the empty string. The KGC daemon cannot start because identity-based cryptography requires the master key pair before it can issue user keys or sign/verify. Note the message itself contains a typo ('execuute').","triggerScenarios":"Thrown at endpoints/kgc/kgc.go:232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the kgc 'setup' subcommand to generate the system parameters and master key pair","Verify the generated keys were written to the config.toml the binary actually reads (etc/ under the executable's directory, not the working directory)","If keys exist elsewhere, copy the MasterPrivateKeyBase64/MasterPublicKeyBase64 values into config.toml","After setup, restart the kgc service"],"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"}