wtfutil/wtf · error

failed to read query config file %s: %w

Error message

failed to read query config file %s: %w

What it means

Wraps the os.ReadFile failure inside readQueryFileContent: the Azure Log Analytics query config file at filePath could not be opened or read (typically the path does not exist, has wrong permissions, or is a directory). This is a wrapped sentinel-style error — the %w carries the underlying os error. The caller readQueryFile propagates it, aborting session configuration; fix by pointing the query file path at an existing, readable .yaml config.

Source

Thrown at modules/azurelogs/config.go:48

		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)
	}

	return configFile, nil
}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Check the query file path in the azurelogs config is correct and absolute if needed
  2. Verify the file exists and is readable by the process user
  3. Check file permissions and that no symlink is broken
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at modules/azurelogs/config.go:48 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/f38811ee633e5b17. Report an issue: GitHub.