{"record":{"id":"bb874c1a950d827c","repo":"hyperledger/fabric","slug":"error-parsing-transient-string","errorCode":null,"errorMessage":"error parsing transient string","messagePattern":"error parsing transient string","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/chaincode/common.go","lineNumber":509,"sourceCode":") (*pb.ProposalResponse, error) {\n\t// Build the ChaincodeInvocationSpec message\n\tinvocation := &pb.ChaincodeInvocationSpec{ChaincodeSpec: spec}\n\n\tcreator, err := signer.Serialize()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"error serializing identity\")\n\t}\n\n\tfuncName := \"invoke\"\n\tif !invoke {\n\t\tfuncName = \"query\"\n\t}\n\n\t// extract the transient field if it exists\n\tvar tMap map[string][]byte\n\tif transient != \"\" {\n\t\tif err := json.Unmarshal([]byte(transient), &tMap); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"error parsing transient string\")\n\t\t}\n\t}\n\n\tprop, txid, err := protoutil.CreateChaincodeProposalWithTxIDAndTransient(pcommon.HeaderType_ENDORSER_TRANSACTION, cID, invocation, creator, txID, tMap)\n\tif err != nil {\n\t\treturn nil, errors.WithMessagef(err, \"error creating proposal for %s\", funcName)\n\t}\n\n\tsignedProp, err := protoutil.GetSignedProposal(prop, signer)\n\tif err != nil {\n\t\treturn nil, errors.WithMessagef(err, \"error creating signed proposal for %s\", funcName)\n\t}\n\n\tresponses, err := processProposals(endorserClients, signedProp)\n\tif err != nil {\n\t\treturn nil, errors.WithMessagef(err, \"error endorsing %s\", funcName)\n\t}\n","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/chaincode/common.go#L491-L527","documentation":"The --transient flag must be valid JSON mapping strings to base64-encoded byte values. ChaincodeInvokeOrQuery unmarshals it before creating the proposal; a malformed value produces this wrapped error.","triggerScenarios":"Passing `--transient` with non-JSON content (e.g. `--transient key=value` instead of `{\"key\":\"...\"}`), single quotes inside the value on Windows shells, or unquoted JSON consumed by the shell.","commonSituations":"Shell quoting issues (curl-style habits, PowerShell escaping), forgetting base64 encoding of values, passing plain key=value syntax from other frameworks.","solutions":["Pass valid JSON: `--transient '{\"secretKey\":\"<base64value>\"}'` with proper shell quoting","Base64-encode each value: `echo -n 'mysecret' | base64` then embed the result","On Windows, use double quotes escaped appropriately or set the value via a script instead of inline"],"exampleFix":"// before\n--transient secret=mysecret\n// after\n--transient '{\"secret\":\"bXlzZWNyZXQ=\"}'","handlingStrategy":"validation","validationCode":"func validateTransient(s string) error {\n    if s == \"\" { return nil }\n    var m map[string][]byte\n    if err := json.Unmarshal([]byte(s), &m); err != nil {\n        return fmt.Errorf(\"transient must be JSON map[string]string(base64): %w\", err)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"error parsing transient string\") {\n    fmt.Println(\"Fix --transient to be valid JSON like '{\\\"key\\\":\\\"<base64>\\\"}' and check shell quoting\")\n}","preventionTips":["Build transient maps programmatically with json.Marshal instead of hand-written strings","Base64-encode values before embedding","Test quoting on the target shell (PowerShell/cmd escaping differs from bash)"],"tags":["fabric","cli","json","transient-data"],"backgroundTag":"invalid-json-arguments","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}