{"record":{"id":"a37fab615e2ebaf1","repo":"zitadel/zitadel","slug":"get-in-tx-order-type-w","errorCode":null,"errorMessage":"get in_tx_order_type: %w","messagePattern":"get in_tx_order_type: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/setup/40.go","lineNumber":106,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"prepare steps: %w\", err)\n\t}\n\treturn []statement{\n\t\t{\n\t\t\tfile:  fileType,\n\t\t\tquery: string(typeStatement),\n\t\t},\n\t\t{\n\t\t\tfile:  fileFunc,\n\t\t\tquery: funcStep.String(),\n\t\t},\n\t}, nil\n}\n\nfunc (mig *InitPushFunc) inTxOrderType(ctx context.Context) (typeName string, err error) {\n\tquery, err := fs.ReadFile(initPushFunc, mig.filePath(fileInTxOrderType))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"get in_tx_order_type: %w\", err)\n\t}\n\n\terr = mig.dbClient.QueryRowContext(ctx, func(row *sql.Row) error {\n\t\treturn row.Scan(&typeName)\n\t}, string(query))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"get in_tx_order_type: %w\", err)\n\t}\n\treturn typeName, nil\n}\n\nfunc (mig *InitPushFunc) filePath(fileName string) string {\n\treturn path.Join(\"40\", fileName)\n}\n","sourceCodeStart":88,"sourceCodeEnd":121,"githubUrl":"https://github.com/zitadel/zitadel/blob/13948f2bcd6f257794dbd6d342c2ac30bc88fe54/cmd/setup/40.go#L88-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n$ ls cmd/setup/40/  # 01_type.sql 02_func.sql (00_ missing)\n// after: restore cmd/setup/40/00_in_tx_order_type.sql and rebuild","handlingStrategy":"try-catch","validationCode":"if _, err := fs.ReadFile(initPushFunc, \"40/00_in_tx_order_type.sql\"); err != nil {\n\treturn fmt.Errorf(\"embedded query file missing: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := mig.Execute(ctx, nil); err != nil {\n\tif strings.Contains(err.Error(), \"get in_tx_order_type\") && errors.Is(err, fs.ErrNotExist) {\n\t\tlog.Printf(\"missing 40/00_in_tx_order_type.sql — rebuild binary\")\n\t\treturn err\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["database","migration","embed","sql"],"backgroundTag":"file-read-failed","analyzedSha":"13948f2bcd6f257794dbd6d342c2ac30bc88fe54","analyzedAt":"2026-09-06T10:16:19.814Z","contentChangedAt":"2026-09-06T10:16:19.814Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}