grafana/k6 · error

marshalling options: %w

Error message

marshalling options: %w

What it means

Error "marshalling options: %w" thrown in grafana/k6.

Source

Thrown at internal/cmd/outputs_cloud.go:145

		return err
	}

	if conf.ProjectID.Int64 == 0 {
		projectID, err := resolveDefaultProjectID(gs, &conf)
		if err != nil {
			return err
		}
		if projectID > 0 {
			conf.ProjectID = null.IntFrom(projectID)
		}
	}

	// Marshal the resolved lib.Options as json.RawMessage for the request
	// body's `options` field. No map[string]any round-trip — preserves
	// typed precision from lib.Options custom marshalers.
	optionsJSON, err := json.Marshal(test.derivedConfig.Options)
	if err != nil {
		return fmt.Errorf("marshalling options: %w", err)
	}

	ctx := gs.Ctx
	result, err := provClient.ProvisionLocalExecution(ctx, provisioning.ProvisionParams{
		Name:          conf.Name.String,
		ProjectID:     conf.ProjectID.Int64,
		MaxVUs:        int64(lib.GetMaxPossibleVUs(executionPlan)), //nolint:gosec
		TotalDuration: int64(duration / time.Second),
		Options:       json.RawMessage(optionsJSON),
		Archive:       testArchive,
	})
	if err != nil {
		return err
	}

	// Stash testRunID in env (existing pattern).
	test.preInitState.RuntimeOptions.Env[testRunIDKey] = strconv.FormatInt(result.TestRunID, 10)

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/cmd/outputs_cloud.go:145 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/1c9a20fbde5e5180. Report an issue: GitHub.