JanDeDobbeleer/oh-my-posh · warning

unknown pulumi spec file format

Error message

unknown pulumi spec file format

What it means

The oh-my-posh pulumi segment reads the Pulumi project spec file (Pulumi.yaml or Pulumi.json) in the current directory to extract the project name. It decides how to parse the file based on the file extension (yaml/json). This error is thrown in the default branch of that switch when the located spec file has an extension the segment does not recognize, so it cannot deserialize the project name.

Source

Thrown at src/segments/pulumi.go:131

		}
	}

	if kind == "" {
		return fmt.Errorf("no pulumi spec file found")
	}

	var pulumiFileSpec pulumiFileSpec
	var err error

	pulumiFile := p.env.FileContent(fileName)

	switch kind {
	case YAML:
		err = yaml.Unmarshal([]byte(pulumiFile), &pulumiFileSpec)
	case JSON:
		err = json.Unmarshal([]byte(pulumiFile), &pulumiFileSpec)
	default:
		err = fmt.Errorf("unknown pulumi spec file format")
	}

	if err != nil {
		log.Error(err)
		return nil
	}

	p.Name = pulumiFileSpec.Name

	p.workspaceSHA1 = p.sha1HexString(p.env.Pwd() + path.Separator() + fileName)

	return nil
}

func (p *Pulumi) sha1HexString(s string) string {
	h := sha1.New()

	_, err := h.Write([]byte(s))

View on GitHub (pinned to 0976794618)

Solutions

  1. Rename the spec file to Pulumi.yaml or Pulumi.json (exact lowercase extension)
  2. Verify only the standard Pulumi.yaml/Pulumi.json files exist in the project root
  3. Check the logged error in the prompt debug output (oh-my-posh debug) to confirm which file was matched

Example fix

// before: file named Pulumi.YAML on Linux
$ mv Pulumi.YAML Pulumi.yaml
// after: segment detects kind == "yaml" and parses the project name
Defensive patterns

Strategy: validation

Validate before calling

if !fileExists("Pulumi.yaml") && !fileExists("Pulumi.json") {
    // segment will be disabled; don't rely on pulumi data in the template
}

Prevention

When it happens

Trigger: A spec file matching the pulumi project layout but with an extension other than .yaml or .json exists in the working directory (the loop in getProjectName picks the last file from the [Pulumi.yaml, Pulumi.json] list present, so kind can only be 'yaml' or 'json'; in practice this branch fires only if a non-standard file is matched by HasFiles or the extension case differs, e.g. Pulumi.YAML on a case-sensitive filesystem).

Common situations: Case-mismatched filenames (Pulumi.YAML) on Linux, custom spec filenames picked up by the segment, or future Pulumi formats the segment does not support yet. The segment logs the error and returns nil from getProjectName, so Enabled returns false and the segment silently disappears.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/74c27af1c6603bc7. Report an issue: GitHub.