hasura/graphql-engine · error

loading .env file failed: %w

Error message

loading .env file failed: %w

What it means

A filter predicate requires an equality comparison against a source column (e.g. for relationship join conditions), but the data connector does not provide an equality operator for that column. Relationship joins and some optimizations rely on equality being available for the mapped column.

Source

Thrown at cli/cli.go:663

	return nil
}

// Validate prepares the ExecutionContext ec and then validates the
// ExecutionDirectory to see if all the required files and directories are in
// place.
func (ec *ExecutionContext) Validate() error {
	var op errors.Op = "cli.ExecutionContext.Validate"
	// validate execution directory
	err := ec.validateDirectory()
	if err != nil {
		return errors.E(op, fmt.Errorf("validating current directory failed: %w", err))
	}

	// load .env file
	err = ec.loadEnvfile()
	if err != nil {
		return errors.E(op, fmt.Errorf("loading .env file failed: %w", err))
	}

	// set names of config file
	ec.ConfigFile = filepath.Join(ec.ExecutionDirectory, "config.yaml")

	// read config and parse the values into Config
	err = ec.readConfig()
	if err != nil {
		return errors.E(op, fmt.Errorf("cannot read config: %w", err))
	}

	// initialize HTTP client
	// CLI uses a common http client defined in internal/httpc.Client
	// get TLS Config
	tlsConfig, err := httpc.GenerateTLSConfig(ec.Config.CAPath, ec.Config.InsecureSkipTLSVerify)
	if err != nil || tlsConfig == nil {
		return errors.E(op, stderrors.New("error while getting TLS config"))
	}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Change the relationship to use columns of a type that supports equality in the connector
  2. Register an equality operator for that column's type in the data connector
  3. Expose the comparison via a command instead of a relationship-based filter
  4. Verify the relationship argument mapping references the intended (comparable) column

Example fix

# before: relationship on jsonb column 'metadata'
# after: relationship on uuid primary key 'id'
argument_mapping: { id: id }
Defensive patterns

Strategy: validation

Validate before calling

// Before defining relationship filters, confirm _eq exists for column types
for (const col of relationshipColumns) {
  if (!connectorHasEquality(col.type)) throw new Error(`No equality operator for ${col.name}`);
}

Type guard

const connectorHasEquality = (typeName) => !!caps.operators?._eq && caps.operators._eq.operand_type === typeName;

Try / catch

try { resolvePredicate(); } catch (e) { if (e?.code === 'MissingEqualOperator') rekeyRelationshipOnPk(); else throw e; }

Prevention

When it happens

Trigger: Defining a relationship whose source/target columns use a type with no equality operator in the connector (e.g. a JSON column in a connector that doesn't support equality on JSON); filtering across a relationship whose argument column type lacks _eq.

Common situations: Relationships on exotic column types (JSONB, arrays, geo types); custom connectors that omit equality operators for certain types; filtering relationship arguments on unsupported types.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/3f97a3380a4a5596. Report an issue: GitHub.