Skip to content

grpc: error while marshaling: string field contains invalid UTF-8 #1967

@t0yv0

Description

@t0yv0

Describe what happened

Getting an error of this form:

{
  "method": "/pulumirpc.ResourceProvider/Create",
  "request": {
    "urn": "urn:pulumi:pulumi-stack-2703659768::pulumi-stack-2703659768::random:index/randomString:RandomString::random",
    "properties": {
      "length": 17,
      "overrideSpecial": "/@£$",
      "special": true
    },
    "name": "random",
    "type": "random:index/randomString:RandomString",
    "resourceStatusAddress": "127.0.0.1:57235",
    "resourceStatusToken": "e972549f-c2a8-4c66-ad76-95e4353ff369"
  },
  "errors": [
    "rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8"
  ],
  "metadata": {
    "kind": "resource",
    "mode": "client",
    "name": "random"
  }
}

Sample program

import * as random from "@pulumi/random";

const randomString = new random.RandomString("random", {
  length: 16,
  special: true,
  overrideSpecial: "/@£$",
});

Log output

N/A

Affected Resource(s)

RandomString

Output of pulumi about

CLI          
Version      3.205.0
Go Version   go1.25.3
Go Compiler  gc

Plugins
KIND      NAME    VERSION
language  nodejs  3.205.0
resource  random  4.18.4

Host     
OS       darwin
Version  15.6.1
Arch     arm64

This project is written in nodejs: executable='/run/current-system/sw/bin/node' version='v22.14.0'

Current Stack: organization/pulumi-stack-2587152882/pulumi-stack-2587152882

TYPE                                    URN
pulumi:pulumi:Stack                     urn:pulumi:pulumi-stack-2587152882::pulumi-stack-2587152882::pulumi:pulumi:Stack::pulumi-stack-2587152882-pulumi-stack-2587152882
pulumi:providers:random                 urn:pulumi:pulumi-stack-2587152882::pulumi-stack-2587152882::pulumi:providers:random::default_4_18_4
random:index/randomString:RandomString  urn:pulumi:pulumi-stack-2587152882::pulumi-stack-2587152882::random:index/randomString:RandomString::random


Found no pending operations associated with pulumi-stack-2587152882

Backend        
Name           anton-mbp-m3.local
URL            file://~
User           anton
Organizations  
Token type     personal

Dependencies:
NAME            VERSION
@pulumi/pulumi  3.212.0
@pulumi/random  4.18.4
@types/node     18.19.130
typescript      5.9.3

Pulumi locates its logs in /var/folders/gd/3ncjb1lj5ljgk8xl5ssn_gvc0000gn/T/ by default

Additional context

To reproduce this start from a state like this:

{"deployment":{"manifest":{"time":"2025-12-17T13:48:24.033382-05:00","magic":"72caf200b8cb26dd4af4f3ba893b9325df78e718846f87a4e0443bd140d097e0","version":"v3.205.0"},"secrets_providers":{"type":"passphrase","state":{"salt":"v1:5JwJwVLBUaA=:v1:9pFY0lnWrb/qQD9O:BlV9XgbM9oPqXuy5xkKp2Q9mueabmw=="}},"resources":[{"urn":"urn:pulumi:pulumi-stack-218490300::pulumi-stack-218490300::pulumi:pulumi:Stack::pulumi-stack-218490300-pulumi-stack-218490300","custom":false,"type":"pulumi:pulumi:Stack","created":"2025-12-17T18:48:24.023019Z","modified":"2025-12-17T18:48:24.023019Z","sourcePosition":"project:///../../../../../../private/var/folders/gd/3ncjb1lj5ljgk8xl5ssn_gvc0000gn/T/pulumi-stack-218490300/node_modules/@pulumi/runtime/stack.ts#37,19","stackTrace":[{"sourcePosition":"project:///../../../../../../private/var/folders/gd/3ncjb1lj5ljgk8xl5ssn_gvc0000gn/T/pulumi-stack-218490300/node_modules/@pulumi/runtime/stack.ts#37,19"},{"sourcePosition":"project:///../../../../../../private/var/folders/gd/3ncjb1lj5ljgk8xl5ssn_gvc0000gn/T/pulumi-stack-218490300/node_modules/@pulumi/cmd/run/run.ts#603,38"}]},{"urn":"urn:pulumi:pulumi-stack-218490300::pulumi-stack-218490300::pulumi:providers:random::default_4_18_1","custom":true,"id":"121c94cf-1177-4e76-97d9-93349a32c7eb","type":"pulumi:providers:random","inputs":{"version":"4.18.1"},"outputs":{"version":"4.18.1"},"created":"2025-12-17T13:48:24.574425-05:00","modified":"2025-12-17T13:48:24.574425-05:00"},{"urn":"urn:pulumi:pulumi-stack-218490300::pulumi-stack-218490300::random:index/randomString:RandomString::random","custom":true,"id":"AO83lSzJJa8auLtb","type":"random:index/randomString:RandomString","inputs":{"__defaults":[],"length":16,"lower":true,"number":true,"numeric":true,"overrideSpecial":"/@£$","special":true,"upper":true},"outputs":{"id":"AO83lSzJJa8auLtb","keepers":null,"length":16,"lower":true,"minLower":0,"minNumeric":0,"minSpecial":0,"minUpper":0,"number":true,"numeric":true,"overrideSpecial":"/@£$","result":"AO83lSzJJa8auLtb","special":true,"upper":true},"parent":"urn:pulumi:pulumi-stack-218490300::pulumi-stack-218490300::pulumi:pulumi:Stack::pulumi-stack-218490300-pulumi-stack-218490300","provider":"urn:pulumi:pulumi-stack-218490300::pulumi-stack-218490300::pulumi:providers:random::default_4_18_1::121c94cf-1177-4e76-97d9-93349a32c7eb","created":"2025-12-17T13:48:24.574425-05:00","modified":"2025-12-17T13:48:24.574425-05:00"}],"metadata":{}},"version":3}

Then keep incrementing length and trying preview and up. Preview succeeds always but up succeeds only intermittently and sometimes manifests the error.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSome behavior is incorrect or out of spec

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions