{"record":{"id":"28de35eaf3e997c5","repo":"caddyserver/caddy","slug":"couldn-t-determine-admin-api-address-v-28de35","errorCode":null,"errorMessage":"couldn't determine admin API address: %v","messagePattern":"couldn't determine admin API address: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddypki/command.go","lineNumber":116,"sourceCode":"\t\t},\n\t})\n}\n\nfunc cmdTrust(fl caddycmd.Flags) (int, error) {\n\tcaID := fl.String(\"ca\")\n\taddrFlag := fl.String(\"address\")\n\tconfigFlag := fl.String(\"config\")\n\tconfigAdapterFlag := fl.String(\"adapter\")\n\n\t// Prepare the URI to the admin endpoint\n\tif caID == \"\" {\n\t\tcaID = DefaultCAID\n\t}\n\n\t// Determine where we're sending the request to get the CA info\n\tadminAddr, err := caddycmd.DetermineAdminAPIAddress(addrFlag, nil, configFlag, configAdapterFlag)\n\tif err != nil {\n\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"couldn't determine admin API address: %v\", err)\n\t}\n\n\t// Fetch the root cert from the admin API\n\trootCert, err := rootCertFromAdmin(adminAddr, caID)\n\tif err != nil {\n\t\treturn caddy.ExitCodeFailedStartup, err\n\t}\n\n\t// Set up the CA struct; we only need to fill in the root\n\t// because we're only using it to make use of the installRoot()\n\t// function. Also needs a logger for warnings, and a \"cert path\"\n\t// for the root cert; since we're loading from the API and we\n\t// don't know the actual storage path via this flow, we'll just\n\t// pass through the admin API address instead.\n\tca := CA{\n\t\tlog:          caddy.Log(),\n\t\troot:         rootCert,\n\t\trootCertPath: adminAddr + path.Join(adminPKIEndpointBase, \"ca\", caID),","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddypki/command.go#L98-L134","documentation":"Error \"couldn't determine admin API address: %v\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddypki/command.go:116 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure Caddy is running with a reachable admin endpoint, or pass the correct --address to the pki command."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}