pulumi/pulumi · error

invalid column number %v

Error message

invalid column number %v

What it means

Same validation path as the line-number error: when converting a gRPC SourcePosition, a non-zero but negative Column value is rejected because column positions must be positive. This indicates the language host sent a malformed source location.

Source

Thrown at pkg/resource/deploy/source_eval.go:2073

		contract.Assertf(filepath.IsAbs(projectRoot), "projectRoot is not an absolute path")
		projectRoot = filepath.Clean(projectRoot)
	}
	return &sourcePositions{projectRoot: projectRoot}
}

func (s *sourcePositions) parseSourcePosition(raw *pulumirpc.SourcePosition) (string, error) {
	if raw == nil {
		return "", nil
	}

	if raw.Line < 0 {
		return "", fmt.Errorf("invalid line number %v", raw.Line)
	}

	col := ""
	if raw.Column != 0 {
		if raw.Column < 0 {
			return "", fmt.Errorf("invalid column number %v", raw.Column)
		}
		col = "," + strconv.FormatInt(int64(raw.Column), 10)
	}

	posURL, err := url.Parse(raw.Uri)
	if err != nil {
		return "", err
	}
	if posURL.Scheme != "file" {
		return "", fmt.Errorf("unrecognized scheme %q", posURL.Scheme)
	}

	file := filepath.FromSlash(posURL.Path)
	if !filepath.IsAbs(file) {
		return "", errors.New("source positions must include absolute paths")
	}
	rel, err := filepath.Rel(s.projectRoot, file)
	if err != nil {

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Upgrade the offending language host/plugin to a version with correct column tracking
  2. Set Column to 0 (meaning absent) when the column is unknown, instead of a negative sentinel
  3. Fix the custom host/tooling to clamp columns to >= 0 before sending the RPC

Example fix

// before
pos := &pulumirpc.SourcePosition{Uri: uri, Line: 10, Column: -3}
// after
pos := &pulumirpc.SourcePosition{Uri: uri, Line: 10, Column: 0}
Defensive patterns

Strategy: validation

Validate before calling

// in custom hosts/tooling, validate before sending:
if raw.Column < 0 { raw.Column = 0 }

Type guard

func validSourcePosition(p *pulumirpc.SourcePosition) bool {
    return p == nil || (p.Line >= 0 && p.Column >= 0)
}

Try / catch

if err != nil && strings.Contains(err.Error(), "invalid column number") {
    // retry without the column or with Column set to 0
}

Prevention

When it happens

Trigger: A language host supplies SourcePosition with Column < 0 while building eval/register RPCs — from buggy column tracking in the host's parser/AST mapping or malformed hand-built requests.

Common situations: Outdated or third-party language plugins with faulty column computation; custom codegen tooling constructing SourcePosition incorrectly; protocol fuzzer/adversarial clients.

Related errors


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