{"record":{"id":"919f52a8d788a5cb","repo":"jackc/pgx","slug":"unable-to-find-service-v","errorCode":null,"errorMessage":"unable to find service: %v","messagePattern":"unable to find service: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/config.go","lineNumber":793,"sourceCode":"\n\t\tif key == \"user\" && val == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tsettings[key] = val\n\t}\n\n\treturn settings, nil\n}\n\nfunc parseServiceSettings(servicefilePath, serviceName string) (map[string]string, error) {\n\tservicefile, err := pgservicefile.ReadServicefile(servicefilePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read service file: %v\", servicefilePath)\n\t}\n\n\tservice, err := servicefile.GetService(serviceName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to find service: %v\", serviceName)\n\t}\n\n\tsettings := make(map[string]string, len(service.Settings))\n\tfor k, v := range service.Settings {\n\t\tsettings[canonicalConnStringKey(k)] = v\n\t}\n\n\treturn settings, nil\n}\n\n// configTLS uses libpq's TLS parameters to construct  []*tls.Config. It is\n// necessary to allow returning multiple TLS configs as sslmode \"allow\" and\n// \"prefer\" allow fallback.\nfunc configTLS(settings map[string]string, thisHost string, parseConfigOptions ParseConfigOptions) ([]*tls.Config, error) {\n\thost := thisHost\n\tsslmode := settings[\"sslmode\"]\n\tsslrootcert := settings[\"sslrootcert\"]\n\tsslcert := settings[\"sslcert\"]","sourceCodeStart":775,"sourceCodeEnd":811,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/config.go#L775-L811","documentation":"The service named in the connection string was not found in the referenced pg_service.conf file. The message shows the service name that was looked up.","triggerScenarios":"Thrown at pgconn/config.go:793 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the service name spelling in the connection string","Verify the service exists in the service file with a matching [section] header","Confirm the correct service file is being read","Add the missing service section to the file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}