hyperledger/fabric · warning

with: %s

Error message

 with: %s

What it means

wrapExitErr appends the captured stderr of a failed exec.Command (' with: %s') to the wrapped error. It is not itself a distinct failure — the trailing 'with: <stderr>' text carries the actual reason (usually go tool output) that the command exited non-zero.

Source

Thrown at core/chaincode/platforms/golang/list.go:98

		if packageInfo.Incomplete {
			return nil, fmt.Errorf("failed to calculate dependencies: incomplete package: %s", packageInfo.ImportPath)
		}
		if !packageInfo.Goroot {
			list = append(list, packageInfo)
		}
	}

	err = cmd.Wait()
	if err != nil {
		return nil, errors.Wrapf(err, "listing deps for package %s failed", pkg)
	}

	return list, nil
}

func wrapExitErr(err error, message string) error {
	if ee, ok := err.(*exec.ExitError); ok {
		return errors.Wrapf(err, message+" with: %s", strings.TrimRight(string(ee.Stderr), "\n\r\t"))
	}
	return errors.Wrap(err, message)
}

type ModuleInfo struct {
	Dir        string
	GoMod      string
	ImportPath string
	ModulePath string
}

// listModuleInfo extracts module information for the curent working directory.
func listModuleInfo(extraEnv ...string) (*ModuleInfo, error) {
	ctx, cancel := context.WithTimeout(context.Background(), listTimeout)
	defer cancel()

	cmd := exec.CommandContext(ctx, "go", "list", "-json", ".")
	cmd.Env = append(os.Environ(), extraEnv...)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Read everything after 'with:' — it contains the authoritative go error
  2. Fix the root cause reported there (module resolution, compile error, bad pattern)
  3. Re-run the equivalent go command locally in the chaincode dir to reproduce and iterate
  4. If stderr is empty, check the wrapped exit status for signal/OOM kills

Example fix

// interpreting
listing deps for package src/chcc failed: exit status 1 with: go: cannot find main module
// fix: add go.mod or set GO111MODULE=off for GOPATH builds
Defensive patterns

Strategy: try-catch

Validate before calling

// run the underlying tool first
cmd := exec.Command("go", "list", "-m", "-json")
var stderr bytes.Buffer
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil { return fmt.Errorf("go failed: %v: %s", err, stderr.String()) }

Type guard

func stderrOf(err error) string { var ee *exec.ExitError; if errors.As(err, &ee) { return strings.TrimSpace(string(ee.Stderr)) }; return "" }

Try / catch

_, err := platform.GetDeploymentPayload(path)
if err != nil {
  if i := strings.Index(err.Error(), " with: "); i >= 0 { log.Print("go stderr:", err.Error()[i+6:]) }
}

Prevention

When it happens

Trigger: Any go tool invocation (gopathDependencyPackageInfo, listModuleInfo, describeGopath, moduleInfo) exits with *exec.ExitError; wrapExitErr decorates it with the trimmed stderr so the message reads '<message>: <err> with: <go stderr>'.

Common situations: Go compile/import errors surfaced in stderr; 'go: cannot find main module'; missing go binary arguments; malformed package patterns passed to go list.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/b7b9c9e7c4593fc8. Report an issue: GitHub.