wtfutil/wtf · error

invalid query file format: %s, expected .yaml

Error message

invalid query file format: %s, expected .yaml

What it means

Validation guard in readQueryFile: the query configuration path does not end with the .yaml extension (the code compares the last 5 characters), so the azurelogs module refuses to parse it as a query file.

Source

Thrown at modules/azurelogs/config.go:37

// readQueryFile reads and parses a query configuration file
func readQueryFile(sess *Session, queryPath string) error {
	file, err := os.OpenFile(queryPath, os.O_RDONLY, 0o600)
	if err != nil {
		return err
	}

	filename := file.Name()
	if len(filename) > 5 && filename[len(filename)-5:] == ".yaml" {
		var configFile QueryFile
		configFile, err = readQueryFileContent(queryPath)
		if err != nil {
			return err
		}

		sess.QueryFile = configFile
	} else {
		return fmt.Errorf("invalid query file format: %s, expected .yaml", filename)
	}

	return nil
}

// readQueryFileContent reads a single config file and returns a QueryFile struct
func readQueryFileContent(filePath string) (QueryFile, error) {
	var configFile QueryFile
	data, err := os.ReadFile(filePath)
	if err != nil {
		return configFile, fmt.Errorf("failed to read query config file %s: %w", filePath, err)
	}

	err = yaml.Unmarshal(data, &configFile)
	if err != nil {
		return configFile, fmt.Errorf("failed to parse YAML in config file %s: %w", filePath, err)
	}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Rename the query config file so it ends with .yaml
  2. Fix the queryPath setting to point at the .yaml file
  3. Note .yml is not accepted by this check — use the .yaml extension
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/azurelogs/config.go:37 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/d8656119130a9282. Report an issue: GitHub.