zitadel/zitadel · error
get in_tx_order_type: %w
Error message
get in_tx_order_type: %w
What it means
This error wraps failures reading the embedded SQL query 40/00_in_tx_order_type.sql in InitPushFunc.inTxOrderType (cmd/setup/40.go:106). That query determines the current in_tx_order_type name from the database so the push function template can be rendered for the correct type version. The library throws it because the type-detection query could not be loaded.
Source
Thrown at cmd/setup/40.go:106
if err != nil {
return nil, fmt.Errorf("prepare steps: %w", err)
}
return []statement{
{
file: fileType,
query: string(typeStatement),
},
{
file: fileFunc,
query: funcStep.String(),
},
}, nil
}
func (mig *InitPushFunc) inTxOrderType(ctx context.Context) (typeName string, err error) {
query, err := fs.ReadFile(initPushFunc, mig.filePath(fileInTxOrderType))
if err != nil {
return "", fmt.Errorf("get in_tx_order_type: %w", err)
}
err = mig.dbClient.QueryRowContext(ctx, func(row *sql.Row) error {
return row.Scan(&typeName)
}, string(query))
if err != nil {
return "", fmt.Errorf("get in_tx_order_type: %w", err)
}
return typeName, nil
}
func (mig *InitPushFunc) filePath(fileName string) string {
return path.Join("40", fileName)
}
View on GitHub (pinned to 13948f2bcd)
Solutions
- Verify cmd/setup/40/00_in_tx_order_type.sql exists (constant fileInTxOrderType)
- Rebuild the binary so go:embed picks up all 40/*.sql files
- Inspect the wrapped cause for the exact missing path
- Retry setup after restoring the file
Example fix
// before $ ls cmd/setup/40/ # 01_type.sql 02_func.sql (00_ missing) // after: restore cmd/setup/40/00_in_tx_order_type.sql and rebuild
Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := fs.ReadFile(initPushFunc, "40/00_in_tx_order_type.sql"); err != nil {
return fmt.Errorf("embedded query file missing: %w", err)
} Try / catch
if err := mig.Execute(ctx, nil); err != nil {
if strings.Contains(err.Error(), "get in_tx_order_type") && errors.Is(err, fs.ErrNotExist) {
log.Printf("missing 40/00_in_tx_order_type.sql — rebuild binary")
return err
}
return err
} Prevention
- Never delete/rename cmd/setup/40/00_in_tx_order_type.sql without updating fileInTxOrderType
- Verify embedded assets exist via a unit test using fs.Glob(initPushFunc, "40/*.sql")
- Rebuild after modifying the embed directory
When it happens
Trigger: Calling Execute on migration 40_init_push_func_v4 when fs.ReadFile(initPushFunc, "40/00_in_tx_order_type.sql") fails — the embedded file is missing from the binary or the filename constant no longer matches the file on disk.
Common situations: A developer deleted/renamed 00_in_tx_order_type.sql in cmd/setup/40/; building from an incomplete tree; binary built from a fork with altered embed directives.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
AI-assisted analysis of zitadel/zitadel@13948f2bcd (2026-09-06).
Data as JSON: /api/errors/a37fab615e2ebaf1.
Report an issue: GitHub.