pulumi/pulumi · error · AssertionError

Plain resource method '{tok}' incorrectly returned {problem}

Error message

Plain resource method '{tok}' incorrectly returned {problem}. This is an error in the provider, please report this to the provider developer.

What it means

Plain (non-output) resource method call results are checked for property-value problems: if the provider returned an unknown or secret value where the calling program expected a plain value, an AssertionError is raised telling the user the provider misbehaved and to report it. This is a runtime integrity check for outputs of `call` operations (resource methods) on plain resources.

Source

Thrown at pkg/codegen/python/utilities.py:271

    typ: typing.Optional[type] = None,
) -> typing.Any:
    """
    Wraps pulumi.runtime.plain to force the output and return it plainly.
    """

    output = pulumi.runtime.call(tok, props, res, typ)

    # Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency.
    result, known, secret, _ = _sync_await(asyncio.create_task(_await_output(output)))

    problem = None
    if not known:
        problem = ' an unknown value'
    elif secret:
        problem = ' a secret value'

    if problem:
        raise AssertionError(
            f"Plain resource method '{tok}' incorrectly returned {problem}. "
            + "This is an error in the provider, please report this to the provider developer."
        )

    return result


async def _await_output(o: pulumi.Output[typing.Any]) -> typing.Tuple[object, bool, bool, set]:
    return (
        await o._future,
        await o._is_known,
        await o._is_secret,
        await o._resources,
    )


# This is included to provide an upgrade path for users who are using a version
# of the Pulumi SDK (<3.121.0) that does not include the `deprecated` decorator.

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Report the bug to the provider developer (as the message instructs) with the method token and a repro
  2. Work around by avoiding the method call during preview (gate it so it only runs with known inputs)
  3. Pin/downgrade to a provider version where the method returns plain values
  4. In application code, unwrap defensively — but note the real fix is in the provider

Example fix

# before (provider implementation)
def method(self, args):
    return Output.secret(compute(args))  # wrongly secret
# after
def method(self, args):
    return compute(args)  # plain result
Defensive patterns

Strategy: try-catch

Validate before calling

# Prefer checking known-ness before relying on a method result in preview:
if pulumi.runtime.is_dry_run():
    # avoid calling plain resource methods whose inputs may be unknown
    ...

Try / catch

try:
    result = resource.some_method(args)
except AssertionError as e:
    if 'Plain resource method' in str(e):
        # provider bug: report upstream; pin provider version or skip in preview
        ...

Prevention

When it happens

Trigger: Calling a resource method (invoke-style method on a resource instance) whose provider implementation returns an Output that is Unknown (depends on an unknown preview value) or marked Secret, while the caller's type context requires a plain, known value.

Common situations: A provider bug where a method implementation wraps its result in pulumi.Output.secret or returns an unknown during preview; using a method on a resource whose inputs are still unknown at preview time; provider SDK misusing the call machinery.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/ec0ca20f92c8624f. Report an issue: GitHub.