infiniflow/ragflow · error · Error
Failed to update search
Error message
Failed to update search
What it means
Thrown by the useUpdateSearch mutation in web/src/pages/next-searches/hooks.ts:313 when searchService.updateSearchSetting resolves with a non-zero business code. RAGFlow APIs wrap failures in code !== 0 even on HTTP 200, so this error means the server rejected the update payload — typically invalid settings, unknown search_id, or a validation failure. The message shown is the fallback string when the server omits message.
Source
Thrown at web/src/pages/next-searches/hooks.ts:313
export type IUpdateSearchProps = Omit<ISearchAppDetailProps, 'id'> & {
search_id: string;
};
export const useUpdateSearch = () => {
const { t } = useTranslation();
const queryClient = useQueryClient();
const {
data,
isError,
mutateAsync: updateSearchMutation,
} = useMutation<any, Error, IUpdateSearchProps>({
mutationKey: ['updateSearch'],
mutationFn: async (formData) => {
const { data: response } =
await searchService.updateSearchSetting(formData);
if (response.code !== 0) {
throw new Error(response.message || 'Failed to update search');
}
return response.data;
},
onSuccess: (data, variables) => {
message.success(t('message.updated'));
queryClient.invalidateQueries({
queryKey: ['searchDetail', variables.search_id],
});
},
});
const updateSearch = useCallback(
(formData: IUpdateSearchProps) => {
return updateSearchMutation(formData);
},
[updateSearchMutation],
);
View on GitHub (pinned to 554fb1133a)
Solutions
- Inspect response.code and response.message from updateSearchSetting to identify the concrete server rejection
- Validate the form payload against the current API schema (required fields, ranges) before mutating
- Confirm search_id matches an existing search by refetching searchDetail first
- Refresh auth/session and retry once if the code indicates an auth failure
- Check backend logs for the update endpoint's validation errors
Example fix
// before
if (response.code !== 0) {
throw new Error(response.message || 'Failed to update search');
}
// after
if (response.code !== 0) {
throw new Error(
`[${response.code}] ${response.message || 'Failed to update search'}`,
);
} Defensive patterns
Strategy: validation
Validate before calling
const canUpdate = (p: IUpdateSearchProps) => Boolean(p.search_id) && Object.keys(p).length > 1;
Type guard
const hasSearchId = (p: unknown): p is IUpdateSearchProps => typeof p === 'object' && p !== null && typeof p.search_id === 'string' && p.search_id.length > 0;
Try / catch
try {
await updateSearchMutation(formData);
} catch (e) {
message.error(e.message || 'update failed'); // surface server message
} Prevention
- Refetch searchDetail before opening the settings form to catch deleted searches early
- Validate form field ranges client-side against the backend schema
When it happens
Trigger: Submitting updateSearchSetting with a search_id that does not exist; sending an invalid configuration field (bad similarity threshold, unknown embedding model id); expired auth token causing the backend to return an error code; concurrency — the search was deleted while the settings form was open.
Common situations: Long-lived settings modal where the entity was removed elsewhere. Backend upgrade changed accepted fields. Form validation gaps letting malformed numbers/strings through. Non-owner user attempting the update.
Related errors
- Failed to delete search
- Failed to list skills folder
- Failed to delete skill
- dataset_id (or kb_id/knowledge_id) is required for retrieval
- SerpApi returned no organic_results.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/0f3bee21fa91cc7d.
Report an issue: GitHub.