dify - 💡(How to fix) Fix RAG Pipeline dataset creation redirects to `/datasets/null/pipeline` due to SQLAlchemy session misuse

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

<!--StartFragment--><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">The frontend redirects to<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/datasets/null/pipeline</code><span> </span>— the dataset ID is<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">null</code><span> </span>— and the page throws a rendering error:</p><blockquote style="color-scheme: unset; forced-color-adjust: unset; math-depth: unset; position: unset; position-anchor: unset; text-size-adjust: unset; appearance: unset; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-feature-settings: unset; font-kerning: unset; font-language-override: unset; font-optical-sizing: unset; font-palette: unset; font-size: 13px; font-size-adjust: unset; font-stretch: unset; font-style: normal; font-synthesis: unset; font-variant-alternates: unset; font-variant-caps: normal; font-variant-east-asian: unset; font-variant-emoji: unset; font-variant-ligatures: normal; font-variant-numeric: unset; font-variant-position: unset; font-variation-settings: unset; font-weight: 400; position-area: unset; text-orientation: unset; text-rendering: unset; text-spacing-trim: unset; -webkit-font-smoothing: unset; -webkit-locale: unset; -webkit-text-orientation: unset; -webkit-writing-mode: unset; writing-mode: unset; zoom: unset; accent-color: unset; place-content: unset; place-items: unset; place-self: unset; alignment-baseline: unset; anchor-name: unset; anchor-scope: unset; animation-composition: unset; animation: unset; animation-trigger: unset; app-region: unset; aspect-ratio: unset; backdrop-filter: unset; backface-visibility: unset; background-attachment: unset; background-blend-mode: unset; background-clip: unset; background-color: rgb(24, 24, 24); background-image: unset; background-origin: unset; background-position: unset; background-repeat: unset; background-size: unset; baseline-shift: unset; baseline-source: unset; block-size: unset; border-block: unset; border: unset; border-radius: unset; border-collapse: unset; border-end-end-radius: unset; border-end-start-radius: unset; border-inline: unset; border-start-end-radius: unset; border-start-start-radius: unset; inset: unset; box-decoration-break: unset; box-shadow: unset; box-sizing: unset; break-after: unset; break-before: unset; break-inside: unset; buffered-rendering: unset; caption-side: unset; caret-animation: unset; caret-color: unset; caret-shape: unset; clear: unset; clip: unset; clip-path: unset; clip-rule: unset; color-interpolation: unset; color-interpolation-filters: unset; color-rendering: unset; columns: unset; column-fill: unset; gap: unset; column-rule: unset; column-span: unset; contain: unset; contain-intrinsic-block-size: unset; contain-intrinsic-size: unset; contain-intrinsic-inline-size: unset; container: unset; content: unset; content-visibility: unset; corner-shape: unset; corner-block-end-shape: unset; corner-block-start-shape: unset; counter-increment: unset; counter-reset: unset; counter-set: unset; cursor: unset; cx: unset; cy: unset; d: unset; display: unset; dominant-baseline: unset; dynamic-range-limit: unset; -electron-corner-smoothing: unset; empty-cells: unset; field-sizing: unset; fill: unset; fill-opacity: unset; fill-rule: unset; filter: unset; flex: unset; flex-flow: unset; float: unset; flood-color: unset; flood-opacity: unset; grid: unset; grid-area: unset; height: unset; hyphenate-character: unset; hyphenate-limit-chars: unset; hyphens: unset; image-orientation: unset; image-rendering: unset; initial-letter: unset; inline-size: unset; inset-block: unset; inset-inline: unset; interactivity: unset; interest-delay: unset; interpolate-size: unset; isolation: unset; letter-spacing: normal; lighting-color: unset; line-break: unset; line-height: unset; list-style: unset; margin-block: unset; margin: unset; margin-inline: unset; marker: unset; mask: unset; mask-type: unset; math-shift: unset; math-style: unset; max-block-size: unset; max-height: unset; max-inline-size: unset; max-width: unset; min-block-size: unset; min-height: unset; min-inline-size: unset; min-width: unset; mix-blend-mode: unset; object-fit: unset; object-position: unset; object-view-box: unset; offset: unset; opacity: unset; order: unset; orphans: 2; outline: unset; outline-offset: unset; overflow-anchor: unset; overflow-block: unset; overflow-clip-margin: unset; overflow-inline: unset; overflow-wrap: unset; overflow: unset; overlay: unset; overscroll-behavior-block: unset; overscroll-behavior-inline: unset; overscroll-behavior: unset; padding-block: unset; padding: unset; padding-inline: unset; page: unset; page-orientation: unset; paint-order: unset; perspective: unset; perspective-origin: unset; pointer-events: unset; position-try: unset; position-visibility: unset; print-color-adjust: unset; quotes: unset; r: unset; reading-flow: unset; reading-order: unset; resize: unset; rotate: unset; ruby-align: unset; ruby-position: unset; rx: unset; ry: unset; scale: unset; scroll-behavior: unset; scroll-initial-target: unset; scroll-margin-block: unset; scroll-margin: unset; scroll-margin-inline: unset; scroll-marker-group: unset; scroll-padding-block: unset; scroll-padding: unset; scroll-padding-inline: unset; scroll-snap-align: unset; scroll-snap-stop: unset; scroll-snap-type: unset; scroll-target-group: unset; scroll-timeline: unset; scrollbar-color: unset; scrollbar-gutter: unset; scrollbar-width: unset; shape-image-threshold: unset; shape-margin: unset; shape-outside: unset; shape-rendering: unset; size: unset; speak: unset; stop-color: unset; stop-opacity: unset; stroke: unset; stroke-dasharray: unset; stroke-dashoffset: unset; stroke-linecap: unset; stroke-linejoin: unset; stroke-miterlimit: unset; stroke-opacity: unset; stroke-width: unset; tab-size: unset; table-layout: unset; text-align: start; text-align-last: unset; text-anchor: unset; text-autospace: unset; text-box: unset; text-combine-upright: unset; text-decoration-color: initial; text-decoration-line: unset; text-decoration-skip-ink: unset; text-decoration-style: initial; text-decoration-thickness: initial; text-emphasis: unset; text-emphasis-position: unset; text-indent: 0px; text-justify: unset; text-overflow: unset; text-shadow: unset; text-transform: none; text-underline-offset: unset; text-underline-position: unset; white-space: normal; text-wrap-style: unset; timeline-scope: unset; timeline-trigger: unset; touch-action: unset; transform: unset; transform-box: unset; transform-origin: unset; transform-style: unset; transition: unset; translate: unset; trigger-scope: unset; user-select: unset; vector-effect: unset; vertical-align: unset; view-timeline: unset; view-transition-class: unset; view-transition-group: unset; view-transition-name: unset; visibility: unset; border-spacing: unset; -webkit-box-align: unset; -webkit-box-decoration-break: unset; -webkit-box-direction: unset; -webkit-box-flex: unset; -webkit-box-ordinal-group: unset; -webkit-box-orient: unset; -webkit-box-pack: unset; -webkit-box-reflect: unset; -webkit-line-break: unset; -webkit-line-clamp: unset; -webkit-mask-box-image: unset; -webkit-rtl-ordering: unset; -webkit-ruby-position: unset; -webkit-tap-highlight-color: unset; -webkit-text-combine: unset; -webkit-text-decorations-in-effect: unset; -webkit-text-fill-color: unset; -webkit-text-security: unset; -webkit-text-stroke-color: unset; -webkit-text-stroke-width: 0px; -webkit-user-drag: unset; widows: 2; width: unset; will-change: unset; word-break: unset; word-spacing: 0px; x: unset; y: unset; z-index: unset;"><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px;">"An unexpected error occurred while rendering this component."</p></blockquote><span style="color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Multiple 404 HTTP requests appear in the browser network panel (e.g. requests to<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/console/api/datasets/null/...</code>).</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Root Cause (confirmed via server-side logs and code inspection):</strong></p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">The<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline</code><span> </span>controller files use<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">sessionmaker(db.engine, ...).begin()</code><span> </span>as a context manager. This is SQLAlchemy's<span> </span><strong style="box-sizing: border-box; font-weight: 600;">auto-transaction mode</strong>, which automatically commits and<span> </span><strong style="box-sizing: border-box; font-weight: 600;">closes the transaction</strong><span> </span>when the<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">with</code><span> </span>block exits normally.</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">However, the<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">RagPipelineDslService</code><span> </span>internally calls<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">self._session.commit()</code><span> </span>at multiple points (lines 328, 340, 465, 477, 588, 631 in<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline_dsl_service.py</code>). Each of these intermediate commits closes the current transaction, causing subsequent session operations (e.g.<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">self._session.scalar()</code><span> </span>at line 596) to raise:</p><div class="cb-markdown-pre-wrapper" style="box-sizing: border-box; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="cb-markdown-pre-container" style="box-sizing: border-box; border-color: color(srgb 0.894118 0.894118 0.894118 / 0.110588); border-style: solid; border-width: 1px; border-image: none 100% / 1 / 0 stretch; border-radius: 4px; overflow: hidden;"><pre class="cb-markdown-pre" style="box-sizing: border-box; margin: 0px; border-top: none; background-color: rgb(20, 20, 20); overflow: auto;"><code style="box-sizing: border-box; display: block; margin-inline: 0px; padding: 6px 12px; border-radius: 0px; background-color: inherit; color: rgba(228, 228, 228, 0.92); overflow-x: auto; scrollbar-color: rgba(228, 228, 228, 0.07) rgba(0, 0, 0, 0); scrollbar-width: thin;">sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.

</code></pre></div></div><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">This matches the pattern used correctly in other parts of the codebase (e.g.<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">app_import.py</code>,<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">workflow.py</code>).</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Server log snippet (before fix):</strong></p><div class="cb-markdown-pre-wrapper" style="box-sizing: border-box; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="cb-markdown-pre-container" style="box-sizing: border-box; border-color: color(srgb 0.894118 0.894118 0.894118 / 0.110588); border-style: solid; border-width: 1px; border-image: none 100% / 1 / 0 stretch; border-radius: 4px; overflow: hidden;"><pre class="cb-markdown-pre" style="box-sizing: border-box; margin: 0px; border-top: none; background-color: rgb(20, 20, 20); overflow: auto;"><code style="box-sizing: border-box; display: block; margin-inline: 0px; padding: 6px 12px; border-radius: 0px; background-color: inherit; color: rgba(228, 228, 228, 0.92); overflow-x: auto; scrollbar-color: rgba(228, 228, 228, 0.07) rgba(0, 0, 0, 0); scrollbar-width: thin;">ERROR in app: Exception on /console/api/datasets [POST] Traceback (most recent call last):

Root Cause

<html> <body> <!--StartFragment--><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">The frontend redirects to<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/datasets/null/pipeline</code><span> </span>— the dataset ID is<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">null</code><span> </span>— and the page throws a rendering error:</p><blockquote style="color-scheme: unset; forced-color-adjust: unset; math-depth: unset; position: unset; position-anchor: unset; text-size-adjust: unset; appearance: unset; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-feature-settings: unset; font-kerning: unset; font-language-override: unset; font-optical-sizing: unset; font-palette: unset; font-size: 13px; font-size-adjust: unset; font-stretch: unset; font-style: normal; font-synthesis: unset; font-variant-alternates: unset; font-variant-caps: normal; font-variant-east-asian: unset; font-variant-emoji: unset; font-variant-ligatures: normal; font-variant-numeric: unset; font-variant-position: unset; font-variation-settings: unset; font-weight: 400; position-area: unset; text-orientation: unset; text-rendering: unset; text-spacing-trim: unset; -webkit-font-smoothing: unset; -webkit-locale: unset; -webkit-text-orientation: unset; -webkit-writing-mode: unset; writing-mode: unset; zoom: unset; accent-color: unset; place-content: unset; place-items: unset; place-self: unset; alignment-baseline: unset; anchor-name: unset; anchor-scope: unset; animation-composition: unset; animation: unset; animation-trigger: unset; app-region: unset; aspect-ratio: unset; backdrop-filter: unset; backface-visibility: unset; background-attachment: unset; background-blend-mode: unset; background-clip: unset; background-color: rgb(24, 24, 24); background-image: unset; background-origin: unset; background-position: unset; background-repeat: unset; background-size: unset; baseline-shift: unset; baseline-source: unset; block-size: unset; border-block: unset; border: unset; border-radius: unset; border-collapse: unset; border-end-end-radius: unset; border-end-start-radius: unset; border-inline: unset; border-start-end-radius: unset; border-start-start-radius: unset; inset: unset; box-decoration-break: unset; box-shadow: unset; box-sizing: unset; break-after: unset; break-before: unset; break-inside: unset; buffered-rendering: unset; caption-side: unset; caret-animation: unset; caret-color: unset; caret-shape: unset; clear: unset; clip: unset; clip-path: unset; clip-rule: unset; color-interpolation: unset; color-interpolation-filters: unset; color-rendering: unset; columns: unset; column-fill: unset; gap: unset; column-rule: unset; column-span: unset; contain: unset; contain-intrinsic-block-size: unset; contain-intrinsic-size: unset; contain-intrinsic-inline-size: unset; container: unset; content: unset; content-visibility: unset; corner-shape: unset; corner-block-end-shape: unset; corner-block-start-shape: unset; counter-increment: unset; counter-reset: unset; counter-set: unset; cursor: unset; cx: unset; cy: unset; d: unset; display: unset; dominant-baseline: unset; dynamic-range-limit: unset; -electron-corner-smoothing: unset; empty-cells: unset; field-sizing: unset; fill: unset; fill-opacity: unset; fill-rule: unset; filter: unset; flex: unset; flex-flow: unset; float: unset; flood-color: unset; flood-opacity: unset; grid: unset; grid-area: unset; height: unset; hyphenate-character: unset; hyphenate-limit-chars: unset; hyphens: unset; image-orientation: unset; image-rendering: unset; initial-letter: unset; inline-size: unset; inset-block: unset; inset-inline: unset; interactivity: unset; interest-delay: unset; interpolate-size: unset; isolation: unset; letter-spacing: normal; lighting-color: unset; line-break: unset; line-height: unset; list-style: unset; margin-block: unset; margin: unset; margin-inline: unset; marker: unset; mask: unset; mask-type: unset; math-shift: unset; math-style: unset; max-block-size: unset; max-height: unset; max-inline-size: unset; max-width: unset; min-block-size: unset; min-height: unset; min-inline-size: unset; min-width: unset; mix-blend-mode: unset; object-fit: unset; object-position: unset; object-view-box: unset; offset: unset; opacity: unset; order: unset; orphans: 2; outline: unset; outline-offset: unset; overflow-anchor: unset; overflow-block: unset; overflow-clip-margin: unset; overflow-inline: unset; overflow-wrap: unset; overflow: unset; overlay: unset; overscroll-behavior-block: unset; overscroll-behavior-inline: unset; overscroll-behavior: unset; padding-block: unset; padding: unset; padding-inline: unset; page: unset; page-orientation: unset; paint-order: unset; perspective: unset; perspective-origin: unset; pointer-events: unset; position-try: unset; position-visibility: unset; print-color-adjust: unset; quotes: unset; r: unset; reading-flow: unset; reading-order: unset; resize: unset; rotate: unset; ruby-align: unset; ruby-position: unset; rx: unset; ry: unset; scale: unset; scroll-behavior: unset; scroll-initial-target: unset; scroll-margin-block: unset; scroll-margin: unset; scroll-margin-inline: unset; scroll-marker-group: unset; scroll-padding-block: unset; scroll-padding: unset; scroll-padding-inline: unset; scroll-snap-align: unset; scroll-snap-stop: unset; scroll-snap-type: unset; scroll-target-group: unset; scroll-timeline: unset; scrollbar-color: unset; scrollbar-gutter: unset; scrollbar-width: unset; shape-image-threshold: unset; shape-margin: unset; shape-outside: unset; shape-rendering: unset; size: unset; speak: unset; stop-color: unset; stop-opacity: unset; stroke: unset; stroke-dasharray: unset; stroke-dashoffset: unset; stroke-linecap: unset; stroke-linejoin: unset; stroke-miterlimit: unset; stroke-opacity: unset; stroke-width: unset; tab-size: unset; table-layout: unset; text-align: start; text-align-last: unset; text-anchor: unset; text-autospace: unset; text-box: unset; text-combine-upright: unset; text-decoration-color: initial; text-decoration-line: unset; text-decoration-skip-ink: unset; text-decoration-style: initial; text-decoration-thickness: initial; text-emphasis: unset; text-emphasis-position: unset; text-indent: 0px; text-justify: unset; text-overflow: unset; text-shadow: unset; text-transform: none; text-underline-offset: unset; text-underline-position: unset; white-space: normal; text-wrap-style: unset; timeline-scope: unset; timeline-trigger: unset; touch-action: unset; transform: unset; transform-box: unset; transform-origin: unset; transform-style: unset; transition: unset; translate: unset; trigger-scope: unset; user-select: unset; vector-effect: unset; vertical-align: unset; view-timeline: unset; view-transition-class: unset; view-transition-group: unset; view-transition-name: unset; visibility: unset; border-spacing: unset; -webkit-box-align: unset; -webkit-box-decoration-break: unset; -webkit-box-direction: unset; -webkit-box-flex: unset; -webkit-box-ordinal-group: unset; -webkit-box-orient: unset; -webkit-box-pack: unset; -webkit-box-reflect: unset; -webkit-line-break: unset; -webkit-line-clamp: unset; -webkit-mask-box-image: unset; -webkit-rtl-ordering: unset; -webkit-ruby-position: unset; -webkit-tap-highlight-color: unset; -webkit-text-combine: unset; -webkit-text-decorations-in-effect: unset; -webkit-text-fill-color: unset; -webkit-text-security: unset; -webkit-text-stroke-color: unset; -webkit-text-stroke-width: 0px; -webkit-user-drag: unset; widows: 2; width: unset; will-change: unset; word-break: unset; word-spacing: 0px; x: unset; y: unset; z-index: unset;"><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px;">"An unexpected error occurred while rendering this component."</p></blockquote><span style="color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Multiple 404 HTTP requests appear in the browser network panel (e.g. requests to<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/console/api/datasets/null/...</code>).</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Root Cause (confirmed via server-side logs and code inspection):</strong></p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">The<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline</code><span> </span>controller files use<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">sessionmaker(db.engine, ...).begin()</code><span> </span>as a context manager. This is SQLAlchemy's<span> </span><strong style="box-sizing: border-box; font-weight: 600;">auto-transaction mode</strong>, which automatically commits and<span> </span><strong style="box-sizing: border-box; font-weight: 600;">closes the transaction</strong><span> </span>when the<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">with</code><span> </span>block exits normally.</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">However, the<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">RagPipelineDslService</code><span> </span>internally calls<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">self._session.commit()</code><span> </span>at multiple points (lines 328, 340, 465, 477, 588, 631 in<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline_dsl_service.py</code>). Each of these intermediate commits closes the current transaction, causing subsequent session operations (e.g.<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">self._session.scalar()</code><span> </span>at line 596) to raise:</p><div class="cb-markdown-pre-wrapper" style="box-sizing: border-box; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="cb-markdown-pre-container" style="box-sizing: border-box; border-color: color(srgb 0.894118 0.894118 0.894118 / 0.110588); border-style: solid; border-width: 1px; border-image: none 100% / 1 / 0 stretch; border-radius: 4px; overflow: hidden;"><pre class="cb-markdown-pre" style="box-sizing: border-box; margin: 0px; border-top: none; background-color: rgb(20, 20, 20); overflow: auto;"><code style="box-sizing: border-box; display: block; margin-inline: 0px; padding: 6px 12px; border-radius: 0px; background-color: inherit; color: rgba(228, 228, 228, 0.92); overflow-x: auto; scrollbar-color: rgba(228, 228, 228, 0.07) rgba(0, 0, 0, 0); scrollbar-width: thin;">sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager. Failing operation: &lt;sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object&gt; </code></pre></div></div><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Because the service raises before returning the pipeline object's<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">id</code>, the API returns<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">null</code><span> </span>for the dataset ID, and the frontend constructs the broken URL<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/datasets/null/pipeline</code>.</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Affected files and lines (all under<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">api/controllers/console/datasets/rag_pipeline/</code>):</strong></p> File | Affected Lines | Pattern -- | -- | -- rag_pipeline_datasets.py | 57 | sessionmaker(db.engine, expire_on_commit=False).begin() rag_pipeline_import.py | 71, 106, 127, 145 | sessionmaker(db.engine, expire_on_commit=False).begin()

Fix Action

Fix / Workaround

<p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Note:<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">expire_on_commit=False</code><span> </span>alone is<span> </span><strong style="box-sizing: border-box; font-weight: 600;">not sufficient</strong><span> </span>— the real issue is<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">.begin()</code><span> </span>auto-transaction mode conflicting with internal<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">commit()</code><span> </span>calls. Other controller files in the same directory (<code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline_workflow.py</code>,<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">data_source.py</code>) share the same pattern.</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Fix (workaround applied locally):</strong></p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Replace<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">sessionmaker(db.engine, expire_on_commit=False).begin()</code><span> </span>with<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">Session(db.engine, expire_on_commit=False)</code><span> </span>(plain session, no auto-transaction), so the service can manage its own commits:</p><div class="cb-markdown-pre-wrapper" style="box-sizing: border-box; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="cb-markdown-pre-container" style="box-sizing: border-box; border-color: color(srgb 0.894118 0.894118 0.894118 / 0.110588); border-style: solid; border-width: 1px; border-image: none 100% / 1 / 0 stretch; border-radius: 4px; overflow: hidden;"><div class="cb-markdown-pre__header" style="box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; border-radius: 4px 4px 0px 0px; background-color: rgb(24, 24, 24);"><strong class="cb-markdown-pre__title" title="python" style="box-sizing: border-box; font-weight: 600; flex: 1 1 0%; min-width: 0px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; font-size: 12px; color: rgba(228, 228, 228, 0.92);">python</strong><div class="_actions_60soq_6" style="box-sizing: border-box; display: flex; align-items: center; gap: 8px; line-height: 20px; font-size: 13px; color: rgba(228, 228, 228, 0.92); overflow-x: hidden; flex-shrink: 0;"><div class="_action_60soq_6" title="复制" role="button" tabindex="0" aria-label="复制" style="box-sizing: border-box; display: flex; padding: 4px; align-items: center; justify-content: center; gap: 4px; cursor: pointer; opacity: 0.7; padding-inline: 4px;"><svg class="_icon_60soq_39" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.3334 5.33301H6.66671C5.93033 5.33301 5.33337 5.92996 5.33337 6.66634V13.333C5.33337 14.0694 5.93033 14.6663 6.66671 14.6663H13.3334C14.0698 14.6663 14.6667 14.0694 14.6667 13.333V6.66634C14.6667 5.92996 14.0698 5.33301 13.3334 5.33301Z" stroke-width="1.3" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.66671 10.6663C1.93337 10.6663 1.33337 10.0663 1.33337 9.33301V2.66634C1.33337 1.93301 1.93337 1.33301 2.66671 1.33301H9.33337C10.0667 1.33301 10.6667 1.93301 10.6667 2.66634" stroke-width="1.3" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="_label_60soq_44" style="box-sizing: border-box; display: block; white-space: nowrap;">复制</span></div><div class="cb-md-divider" style="box-sizing: border-box; width: 0.5px; height: 16px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(255, 255, 255, 0.1); opacity: 0.6;"></div><div class="cb-markdown-pre__action" role="button" tabindex="0" aria-label="Collapse" aria-expanded="true" style="box-sizing: border-box; display: flex; padding: 4px; align-items: center; justify-content: center; gap: 4px; cursor: pointer; opacity: 0.7; padding-inline: 4px;"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="cb-markdown-pre__icon"><path d="m6 9 6 6 6-6"></path></svg></div></div></div><pre class="cb-markdown-pre" style="box-sizing: border-box; margin: 0px; border-top: none; background-color: rgb(20, 20, 20); overflow: auto;"><code class="hljs language-python" style="box-sizing: border-box; display: block; margin-inline: 0px; padding: 6px 12px; border-radius: 0px; background: transparent; color: rgba(228, 228, 228, 0.92); overflow-x: auto; scrollbar-color: rgba(228, 228, 228, 0.07) rgba(0, 0, 0, 0); scrollbar-width: thin;"><span class="hljs-comment" style="box-sizing: border-box; color: rgb(106, 153, 85); font-style: italic;"># Before (broken)</span> <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">from</span> sqlalchemy.orm <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">import</span> sessionmaker <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">with</span> sessionmaker(db.engine, expire_on_commit=<span class="hljs-literal" style="box-sizing: border-box; color: rgb(181, 206, 168);">False</span>).begin() <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">as</span> session: ...
RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.14.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Deploy Dify v1.14.0 using the official Docker Compose setup

  2. Navigate to Knowledge → RAG Pipeline

  3. Create a new Knowledge Base using the Knowledge Pipeline workflow

  4. Fill in the required fields and submit the creation form

  5. After submission, observe the browser URL and the page content

✔️ Expected Behavior

After successfully creating a knowledge base through the RAG Pipeline, the frontend should redirect to the correct URL like /datasets/<valid-uuid>/pipeline, and the pipeline page should render normally.

❌ Actual Behavior

<html> <body> <!--StartFragment--><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">The frontend redirects to<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/datasets/null/pipeline</code><span> </span>— the dataset ID is<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">null</code><span> </span>— and the page throws a rendering error:</p><blockquote style="color-scheme: unset; forced-color-adjust: unset; math-depth: unset; position: unset; position-anchor: unset; text-size-adjust: unset; appearance: unset; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-feature-settings: unset; font-kerning: unset; font-language-override: unset; font-optical-sizing: unset; font-palette: unset; font-size: 13px; font-size-adjust: unset; font-stretch: unset; font-style: normal; font-synthesis: unset; font-variant-alternates: unset; font-variant-caps: normal; font-variant-east-asian: unset; font-variant-emoji: unset; font-variant-ligatures: normal; font-variant-numeric: unset; font-variant-position: unset; font-variation-settings: unset; font-weight: 400; position-area: unset; text-orientation: unset; text-rendering: unset; text-spacing-trim: unset; -webkit-font-smoothing: unset; -webkit-locale: unset; -webkit-text-orientation: unset; -webkit-writing-mode: unset; writing-mode: unset; zoom: unset; accent-color: unset; place-content: unset; place-items: unset; place-self: unset; alignment-baseline: unset; anchor-name: unset; anchor-scope: unset; animation-composition: unset; animation: unset; animation-trigger: unset; app-region: unset; aspect-ratio: unset; backdrop-filter: unset; backface-visibility: unset; background-attachment: unset; background-blend-mode: unset; background-clip: unset; background-color: rgb(24, 24, 24); background-image: unset; background-origin: unset; background-position: unset; background-repeat: unset; background-size: unset; baseline-shift: unset; baseline-source: unset; block-size: unset; border-block: unset; border: unset; border-radius: unset; border-collapse: unset; border-end-end-radius: unset; border-end-start-radius: unset; border-inline: unset; border-start-end-radius: unset; border-start-start-radius: unset; inset: unset; box-decoration-break: unset; box-shadow: unset; box-sizing: unset; break-after: unset; break-before: unset; break-inside: unset; buffered-rendering: unset; caption-side: unset; caret-animation: unset; caret-color: unset; caret-shape: unset; clear: unset; clip: unset; clip-path: unset; clip-rule: unset; color-interpolation: unset; color-interpolation-filters: unset; color-rendering: unset; columns: unset; column-fill: unset; gap: unset; column-rule: unset; column-span: unset; contain: unset; contain-intrinsic-block-size: unset; contain-intrinsic-size: unset; contain-intrinsic-inline-size: unset; container: unset; content: unset; content-visibility: unset; corner-shape: unset; corner-block-end-shape: unset; corner-block-start-shape: unset; counter-increment: unset; counter-reset: unset; counter-set: unset; cursor: unset; cx: unset; cy: unset; d: unset; display: unset; dominant-baseline: unset; dynamic-range-limit: unset; -electron-corner-smoothing: unset; empty-cells: unset; field-sizing: unset; fill: unset; fill-opacity: unset; fill-rule: unset; filter: unset; flex: unset; flex-flow: unset; float: unset; flood-color: unset; flood-opacity: unset; grid: unset; grid-area: unset; height: unset; hyphenate-character: unset; hyphenate-limit-chars: unset; hyphens: unset; image-orientation: unset; image-rendering: unset; initial-letter: unset; inline-size: unset; inset-block: unset; inset-inline: unset; interactivity: unset; interest-delay: unset; interpolate-size: unset; isolation: unset; letter-spacing: normal; lighting-color: unset; line-break: unset; line-height: unset; list-style: unset; margin-block: unset; margin: unset; margin-inline: unset; marker: unset; mask: unset; mask-type: unset; math-shift: unset; math-style: unset; max-block-size: unset; max-height: unset; max-inline-size: unset; max-width: unset; min-block-size: unset; min-height: unset; min-inline-size: unset; min-width: unset; mix-blend-mode: unset; object-fit: unset; object-position: unset; object-view-box: unset; offset: unset; opacity: unset; order: unset; orphans: 2; outline: unset; outline-offset: unset; overflow-anchor: unset; overflow-block: unset; overflow-clip-margin: unset; overflow-inline: unset; overflow-wrap: unset; overflow: unset; overlay: unset; overscroll-behavior-block: unset; overscroll-behavior-inline: unset; overscroll-behavior: unset; padding-block: unset; padding: unset; padding-inline: unset; page: unset; page-orientation: unset; paint-order: unset; perspective: unset; perspective-origin: unset; pointer-events: unset; position-try: unset; position-visibility: unset; print-color-adjust: unset; quotes: unset; r: unset; reading-flow: unset; reading-order: unset; resize: unset; rotate: unset; ruby-align: unset; ruby-position: unset; rx: unset; ry: unset; scale: unset; scroll-behavior: unset; scroll-initial-target: unset; scroll-margin-block: unset; scroll-margin: unset; scroll-margin-inline: unset; scroll-marker-group: unset; scroll-padding-block: unset; scroll-padding: unset; scroll-padding-inline: unset; scroll-snap-align: unset; scroll-snap-stop: unset; scroll-snap-type: unset; scroll-target-group: unset; scroll-timeline: unset; scrollbar-color: unset; scrollbar-gutter: unset; scrollbar-width: unset; shape-image-threshold: unset; shape-margin: unset; shape-outside: unset; shape-rendering: unset; size: unset; speak: unset; stop-color: unset; stop-opacity: unset; stroke: unset; stroke-dasharray: unset; stroke-dashoffset: unset; stroke-linecap: unset; stroke-linejoin: unset; stroke-miterlimit: unset; stroke-opacity: unset; stroke-width: unset; tab-size: unset; table-layout: unset; text-align: start; text-align-last: unset; text-anchor: unset; text-autospace: unset; text-box: unset; text-combine-upright: unset; text-decoration-color: initial; text-decoration-line: unset; text-decoration-skip-ink: unset; text-decoration-style: initial; text-decoration-thickness: initial; text-emphasis: unset; text-emphasis-position: unset; text-indent: 0px; text-justify: unset; text-overflow: unset; text-shadow: unset; text-transform: none; text-underline-offset: unset; text-underline-position: unset; white-space: normal; text-wrap-style: unset; timeline-scope: unset; timeline-trigger: unset; touch-action: unset; transform: unset; transform-box: unset; transform-origin: unset; transform-style: unset; transition: unset; translate: unset; trigger-scope: unset; user-select: unset; vector-effect: unset; vertical-align: unset; view-timeline: unset; view-transition-class: unset; view-transition-group: unset; view-transition-name: unset; visibility: unset; border-spacing: unset; -webkit-box-align: unset; -webkit-box-decoration-break: unset; -webkit-box-direction: unset; -webkit-box-flex: unset; -webkit-box-ordinal-group: unset; -webkit-box-orient: unset; -webkit-box-pack: unset; -webkit-box-reflect: unset; -webkit-line-break: unset; -webkit-line-clamp: unset; -webkit-mask-box-image: unset; -webkit-rtl-ordering: unset; -webkit-ruby-position: unset; -webkit-tap-highlight-color: unset; -webkit-text-combine: unset; -webkit-text-decorations-in-effect: unset; -webkit-text-fill-color: unset; -webkit-text-security: unset; -webkit-text-stroke-color: unset; -webkit-text-stroke-width: 0px; -webkit-user-drag: unset; widows: 2; width: unset; will-change: unset; word-break: unset; word-spacing: 0px; x: unset; y: unset; z-index: unset;"><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px;">"An unexpected error occurred while rendering this component."</p></blockquote><span style="color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Multiple 404 HTTP requests appear in the browser network panel (e.g. requests to<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/console/api/datasets/null/...</code>).</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Root Cause (confirmed via server-side logs and code inspection):</strong></p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">The<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline</code><span> </span>controller files use<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">sessionmaker(db.engine, ...).begin()</code><span> </span>as a context manager. This is SQLAlchemy's<span> </span><strong style="box-sizing: border-box; font-weight: 600;">auto-transaction mode</strong>, which automatically commits and<span> </span><strong style="box-sizing: border-box; font-weight: 600;">closes the transaction</strong><span> </span>when the<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">with</code><span> </span>block exits normally.</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">However, the<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">RagPipelineDslService</code><span> </span>internally calls<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">self._session.commit()</code><span> </span>at multiple points (lines 328, 340, 465, 477, 588, 631 in<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline_dsl_service.py</code>). Each of these intermediate commits closes the current transaction, causing subsequent session operations (e.g.<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">self._session.scalar()</code><span> </span>at line 596) to raise:</p><div class="cb-markdown-pre-wrapper" style="box-sizing: border-box; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="cb-markdown-pre-container" style="box-sizing: border-box; border-color: color(srgb 0.894118 0.894118 0.894118 / 0.110588); border-style: solid; border-width: 1px; border-image: none 100% / 1 / 0 stretch; border-radius: 4px; overflow: hidden;"><pre class="cb-markdown-pre" style="box-sizing: border-box; margin: 0px; border-top: none; background-color: rgb(20, 20, 20); overflow: auto;"><code style="box-sizing: border-box; display: block; margin-inline: 0px; padding: 6px 12px; border-radius: 0px; background-color: inherit; color: rgba(228, 228, 228, 0.92); overflow-x: auto; scrollbar-color: rgba(228, 228, 228, 0.07) rgba(0, 0, 0, 0); scrollbar-width: thin;">sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager. Failing operation: &lt;sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object&gt; </code></pre></div></div><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Because the service raises before returning the pipeline object's<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">id</code>, the API returns<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">null</code><span> </span>for the dataset ID, and the frontend constructs the broken URL<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">/datasets/null/pipeline</code>.</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Affected files and lines (all under<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">api/controllers/console/datasets/rag_pipeline/</code>):</strong></p> File | Affected Lines | Pattern -- | -- | -- rag_pipeline_datasets.py | 57 | sessionmaker(db.engine, expire_on_commit=False).begin() rag_pipeline_import.py | 71, 106, 127, 145 | sessionmaker(db.engine, expire_on_commit=False).begin() <p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Note:<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">expire_on_commit=False</code><span> </span>alone is<span> </span><strong style="box-sizing: border-box; font-weight: 600;">not sufficient</strong><span> </span>— the real issue is<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">.begin()</code><span> </span>auto-transaction mode conflicting with internal<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">commit()</code><span> </span>calls. Other controller files in the same directory (<code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">rag_pipeline_workflow.py</code>,<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">data_source.py</code>) share the same pattern.</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Fix (workaround applied locally):</strong></p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Replace<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">sessionmaker(db.engine, expire_on_commit=False).begin()</code><span> </span>with<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">Session(db.engine, expire_on_commit=False)</code><span> </span>(plain session, no auto-transaction), so the service can manage its own commits:</p><div class="cb-markdown-pre-wrapper" style="box-sizing: border-box; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="cb-markdown-pre-container" style="box-sizing: border-box; border-color: color(srgb 0.894118 0.894118 0.894118 / 0.110588); border-style: solid; border-width: 1px; border-image: none 100% / 1 / 0 stretch; border-radius: 4px; overflow: hidden;"><div class="cb-markdown-pre__header" style="box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; border-radius: 4px 4px 0px 0px; background-color: rgb(24, 24, 24);"><strong class="cb-markdown-pre__title" title="python" style="box-sizing: border-box; font-weight: 600; flex: 1 1 0%; min-width: 0px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; font-size: 12px; color: rgba(228, 228, 228, 0.92);">python</strong><div class="_actions_60soq_6" style="box-sizing: border-box; display: flex; align-items: center; gap: 8px; line-height: 20px; font-size: 13px; color: rgba(228, 228, 228, 0.92); overflow-x: hidden; flex-shrink: 0;"><div class="_action_60soq_6" title="复制" role="button" tabindex="0" aria-label="复制" style="box-sizing: border-box; display: flex; padding: 4px; align-items: center; justify-content: center; gap: 4px; cursor: pointer; opacity: 0.7; padding-inline: 4px;"><svg class="_icon_60soq_39" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.3334 5.33301H6.66671C5.93033 5.33301 5.33337 5.92996 5.33337 6.66634V13.333C5.33337 14.0694 5.93033 14.6663 6.66671 14.6663H13.3334C14.0698 14.6663 14.6667 14.0694 14.6667 13.333V6.66634C14.6667 5.92996 14.0698 5.33301 13.3334 5.33301Z" stroke-width="1.3" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.66671 10.6663C1.93337 10.6663 1.33337 10.0663 1.33337 9.33301V2.66634C1.33337 1.93301 1.93337 1.33301 2.66671 1.33301H9.33337C10.0667 1.33301 10.6667 1.93301 10.6667 2.66634" stroke-width="1.3" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="_label_60soq_44" style="box-sizing: border-box; display: block; white-space: nowrap;">复制</span></div><div class="cb-md-divider" style="box-sizing: border-box; width: 0.5px; height: 16px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(255, 255, 255, 0.1); opacity: 0.6;"></div><div class="cb-markdown-pre__action" role="button" tabindex="0" aria-label="Collapse" aria-expanded="true" style="box-sizing: border-box; display: flex; padding: 4px; align-items: center; justify-content: center; gap: 4px; cursor: pointer; opacity: 0.7; padding-inline: 4px;"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="cb-markdown-pre__icon"><path d="m6 9 6 6 6-6"></path></svg></div></div></div><pre class="cb-markdown-pre" style="box-sizing: border-box; margin: 0px; border-top: none; background-color: rgb(20, 20, 20); overflow: auto;"><code class="hljs language-python" style="box-sizing: border-box; display: block; margin-inline: 0px; padding: 6px 12px; border-radius: 0px; background: transparent; color: rgba(228, 228, 228, 0.92); overflow-x: auto; scrollbar-color: rgba(228, 228, 228, 0.07) rgba(0, 0, 0, 0); scrollbar-width: thin;"><span class="hljs-comment" style="box-sizing: border-box; color: rgb(106, 153, 85); font-style: italic;"># Before (broken)</span> <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">from</span> sqlalchemy.orm <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">import</span> sessionmaker <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">with</span> sessionmaker(db.engine, expire_on_commit=<span class="hljs-literal" style="box-sizing: border-box; color: rgb(181, 206, 168);">False</span>).begin() <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">as</span> session: ...

<span class="hljs-comment" style="box-sizing: border-box; color: rgb(106, 153, 85); font-style: italic;"># After (fixed)</span> <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">from</span> sqlalchemy.orm <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">import</span> Session <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">with</span> Session(db.engine, expire_on_commit=<span class="hljs-literal" style="box-sizing: border-box; color: rgb(181, 206, 168);">False</span>) <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(255, 123, 114);">as</span> session: ... </code></pre></div></div><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">This matches the pattern used correctly in other parts of the codebase (e.g.<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">app_import.py</code>,<span> </span><code class="" style="box-sizing: border-box; padding-inline: 4px; border-radius: 3px; background-color: rgba(255, 255, 255, 0.1); color: rgba(228, 228, 228, 0.92); pointer-events: none;">workflow.py</code>).</p><p style="box-sizing: border-box; margin: 0px; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: 600;">Server log snippet (before fix):</strong></p><div class="cb-markdown-pre-wrapper" style="box-sizing: border-box; padding-bottom: 12px; color: rgba(228, 228, 228, 0.92); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="cb-markdown-pre-container" style="box-sizing: border-box; border-color: color(srgb 0.894118 0.894118 0.894118 / 0.110588); border-style: solid; border-width: 1px; border-image: none 100% / 1 / 0 stretch; border-radius: 4px; overflow: hidden;"><pre class="cb-markdown-pre" style="box-sizing: border-box; margin: 0px; border-top: none; background-color: rgb(20, 20, 20); overflow: auto;"><code style="box-sizing: border-box; display: block; margin-inline: 0px; padding: 6px 12px; border-radius: 0px; background-color: inherit; color: rgba(228, 228, 228, 0.92); overflow-x: auto; scrollbar-color: rgba(228, 228, 228, 0.07) rgba(0, 0, 0, 0); scrollbar-width: thin;">ERROR in app: Exception on /console/api/datasets [POST] Traceback (most recent call last): File ".../rag_pipeline_datasets.py", line 57, in post with sessionmaker(db.engine, expire_on_commit=False).begin() as session: ... File ".../rag_pipeline_dsl_service.py", line 596, in _create_dataset_by_pipeline_config dataset = self._session.scalar(...) sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.</code></pre></div></div><!--EndFragment-->

</body> </html>

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING