Skip to content

Fix missing flowData for CustomTemplate Tool during import#5542

Merged
yau-wd merged 1 commit into
mainfrom
fix/custom-template-tool-import
Dec 2, 2025
Merged

Fix missing flowData for CustomTemplate Tool during import#5542
yau-wd merged 1 commit into
mainfrom
fix/custom-template-tool-import

Conversation

@chungyau97
Copy link
Copy Markdown
Contributor

@chungyau97 chungyau97 commented Dec 2, 2025

Description

Fix null value in column "flowData" of relation "custom_template" violates not-null constraint.

Result

Enterprise

Before After
image image

Cloud

Before After
image image

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @chungyau97, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where custom template tools might lack essential flow data when imported into the system. By programmatically populating this data during the import process, it ensures the integrity and functionality of these tools, improving overall system robustness and backward compatibility for existing exports.

Highlights

  • Fix for CustomTemplate Tool Import: Implemented a fix to ensure that CustomTemplate type Tools have their flowData correctly populated during the import process. This addresses cases where flowData might be missing.
  • Backward Compatibility: The change includes logic to handle backward compatibility for previously exported data where CustomTemplate type Tools did not include the flowData field, preventing import issues.
  • Data Structure Correction: During import, if an item is identified as a 'Tool', its flowData field is now constructed from iconSrc, schema, and func properties, ensuring the correct data structure.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue with missing flowData for CustomTemplate of type Tool during the import process. The fix correctly reconstructs the flowData from other properties on the imported object. However, the condition used to identify the relevant items is a bit fragile and could lead to errors in the future if the Tool entity is modified. I've added a review comment with a suggestion to make the check more robust and prevent potential bugs.

function insertWorkspaceId(importedData: any, activeWorkspaceId?: string) {
if (!activeWorkspaceId) return importedData
importedData.forEach((item: any) => {
if (item.type === 'Tool') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The condition item.type === 'Tool' is a bit fragile. While it currently works because Tool entities don't have a type property, this could change in the future. If a Tool object ever gets a type: 'Tool' property, this code would add a flowData property to it. Since the Tool entity doesn't have a flowData column, this would cause a database error upon saving.

A more robust check would be to also verify that the item is a CustomTemplate. A simple way to do this is to check for a property that exists on CustomTemplate but not on Tool, like badge.

Suggested change
if (item.type === 'Tool') {
if (item.type === 'Tool' && 'badge' in item) {

@chungyau97 chungyau97 self-assigned this Dec 2, 2025
@chungyau97 chungyau97 added the bug Something isn't working label Dec 2, 2025
@yau-wd yau-wd merged commit 6fb97ce into main Dec 2, 2025
6 checks passed
@yau-wd yau-wd deleted the fix/custom-template-tool-import branch December 2, 2025 11:51
davehamptonusa pushed a commit to davehamptonusa/Flowise that referenced this pull request Dec 8, 2025
…#5542)

fix(services/export-import): import missing flowData for Custom Template Tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants