{"id":"f544f19949da5b02","repo":"docker/cli","slug":"error-establishing-connection-to-trust-repository","errorCode":null,"errorMessage":"error establishing connection to trust repository: %w","messagePattern":"error establishing connection to trust repository: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker-trust/internal/trust/trust_push.go","lineNumber":104,"sourceCode":"\t}\n\n\tif err := jsonstream.Display(ctx, in, ioStreams.Out(), jsonstream.WithAuxCallback(handleTarget)); err != nil {\n\t\treturn err\n\t}\n\n\tif cnt > 1 {\n\t\treturn errors.New(\"internal error: only one call to handleTarget expected\")\n\t}\n\n\tif notaryTarget == nil {\n\t\treturn errors.New(\"no targets found, provide a specific tag in order to sign it\")\n\t}\n\n\t_, _ = fmt.Fprintln(ioStreams.Out(), \"Signing and pushing trust metadata\")\n\n\trepo, err := GetNotaryRepository(ioStreams.In(), ioStreams.Out(), userAgent, repoInfo, &authConfig, \"push\", \"pull\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error establishing connection to trust repository: %w\", err)\n\t}\n\n\t// get the latest repository metadata so we can figure out which roles to sign\n\t_, err = repo.ListTargets()\n\n\tswitch err.(type) {\n\tcase client.ErrRepoNotInitialized, client.ErrRepositoryNotExist:\n\t\tkeys := repo.GetCryptoService().ListKeys(data.CanonicalRootRole)\n\t\tvar rootKeyID string\n\t\t// always select the first root key\n\t\tif len(keys) > 0 {\n\t\t\tsort.Strings(keys)\n\t\t\trootKeyID = keys[0]\n\t\t} else {\n\t\t\trootPublicKey, err := repo.GetCryptoService().Create(data.CanonicalRootRole, \"\", data.ECDSAKey)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cmd/docker-trust/internal/trust/trust_push.go#L86-L122","documentation":"Error \"error establishing connection to trust repository: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cmd/docker-trust/internal/trust/trust_push.go:104 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}