{"id":"ada0b777f8ac640e","repo":"docker/cli","slug":"internal-error-only-one-call-to-handletarget-expe","errorCode":null,"errorMessage":"internal error: only one call to handleTarget expected","messagePattern":"internal error: only one call to handleTarget expected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker-trust/internal/trust/trust_push.go","lineNumber":93,"sourceCode":"\t\treturn errors.New(\"cannot push a digest reference\")\n\tcase reference.Tagged:\n\t\ttag = x.Tag()\n\tdefault:\n\t\t// We want trust signatures to always take an explicit tag,\n\t\t// otherwise it will act as an untrusted push.\n\t\tif err := jsonstream.Display(ctx, in, ioStreams.Out()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, _ = fmt.Fprintln(ioStreams.Err(), \"No tag specified, skipping trust metadata push\")\n\t\treturn nil\n\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:","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cmd/docker-trust/internal/trust/trust_push.go#L75-L111","documentation":"Error \"internal error: only one call to handleTarget expected\" thrown in docker/cli.","triggerScenarios":"Thrown at cmd/docker-trust/internal/trust/trust_push.go:93 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}