Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Show the engine's English failure reason on Autopilot cards

Bowen Xue0bf3bc1d19ce
diff --git a/freevideo_engine/agent/cast.py b/freevideo_engine/agent/cast.py
index 8352d5c..1e7d4a2 100644
--- a/freevideo_engine/agent/cast.py
+++ b/freevideo_engine/agent/cast.py
@@ -807,7 +807,7 @@ class Cast:
code = (row.get('error') or {}).get('code') if row else 'not_found'
code = code or (row['status'] if row else 'not_found')
detail = errors.image_failure(code, (row.get('error') or {}).get('report_id') if row else None)
- failure = failure or dict(code=code, job=job, error_zh=detail['reason']['zh'], message=(
+ failure = failure or dict(code=code, job=job, error_zh=detail['reason']['zh'], error_en=detail['reason']['en'], message=(
'The generation was cancelled.' if row and row['status'] == 'cancelled'
else detail['reason']['en']), **detail)
continue
@@ -843,7 +843,7 @@ class Cast:
if row is None or row['status'] != 'succeeded':
code = (row.get('error') or {}).get('code') if row else 'not_found'
failure = failure or dict(code=code or row['status'], job=job,
- error_zh=errors.failure_reason((row.get('error') or dict(code=code or row['status'])) if row else dict(code=code)), message=(
+ **errors.reasons((row.get('error') or dict(code=code or row['status'])) if row else dict(code=code)), message=(
'The generation was cancelled.' if row and row['status'] == 'cancelled'
else 'The reference clip did not finish.'))
continue
diff --git a/freevideo_engine/agent/errors.py b/freevideo_engine/agent/errors.py
index 77c55cb..7e073c5 100644
--- a/freevideo_engine/agent/errors.py
+++ b/freevideo_engine/agent/errors.py
@@ -306,6 +306,53 @@ FAILURE_REASONS_ZH = {
'generation_failed': '生成没有完成',
'internal_error': '没有完成',
}
+FAILURE_REASONS_EN = {
+ 'lan_unavailable': 'Phone access requires FreeVideo installed with the launcher',
+ 'out_of_memory': 'Graphics or system memory ran out during generation',
+ 'insufficient_memory': 'There is not enough free graphics or system memory for this generation',
+ 'no_memory': 'There is not enough free graphics or system memory for this picture',
+ 'ram_space': 'System memory ran out while loading the model',
+ 'model_missing': 'A required model is not installed yet',
+ 'pack_missing': 'The image model is not installed yet',
+ 'not_ready': 'The generation environment is not installed yet',
+ 'cancelled': 'Generation was stopped',
+ 'stopped_by_user': 'Generation was stopped',
+ 'interrupted': 'Generation was interrupted',
+ 'worker_exit': 'Picture generation was interrupted',
+ 'closed': 'The picture generation service has closed',
+ 'image_unavailable': 'The picture generation service has not started yet',
+ 'vlm_unavailable': 'The model that reads pictures has not started yet',
+ 'vlm_failed': 'The picture could not be read',
+ 'vlm_invalid_json': 'The reply could not be read',
+ 'context_length': 'The description and reference pictures are too long',
+ 'dependency_failed': 'A task this one depends on did not finish',
+ 'lost': 'The generation service no longer has the result of this task',
+ 'unknown_job': 'The picture generation service cannot find this task',
+ 'not_found': 'This task or media file cannot be found',
+ 'source_missing': 'The previous video needed to continue is no longer available',
+ 'chain_missing': 'The generation record needed to continue is no longer available',
+ 'chain_unavailable': 'The part-by-part generation service has not started yet',
+ 'continuation_unavailable': 'The current generation mode cannot continue a video',
+ 'join_failed': 'The parts were generated, but joining them into one video failed',
+ 'invalid_output': 'The result could not be read or saved',
+ 'storage_unavailable': 'The task record or media could not be written to disk',
+ 'submit_interrupted': 'The service stopped during submission, so it is not confirmed whether the task started',
+ 'timeout': 'Generation took too long without a result',
+ 'invalid_media': 'The reference media could not be read',
+ 'clip_unreadable': 'The generated character reference video could not be read',
+ 'invalid_request': 'The generation settings are outside the supported range',
+ 'invalid_drama': 'The short film settings are invalid',
+ 'reshoot_limit': 'This shot has reached its generation limit',
+ 'production_limit': 'This short film has reached its task limit',
+ 'export_failed': 'Exporting the video failed',
+ 'invalid_prompt': 'The picture description is empty or too long',
+ 'invalid_dimensions': 'The picture size is outside the supported range',
+ 'too_many_images': 'There are more reference pictures than supported',
+ 'chain_too_long': 'The continued video has more parts than supported',
+ 'chain_rejected': 'The generation service cannot use these settings',
+ 'generation_failed': 'Generation did not finish',
+ 'internal_error': 'Did not finish',
+}
FAILURE_MESSAGES_ZH = {
'The previous video is too short to continue; it needs to be at least 1.7 s long.': '接续的上一段视频太短,至少需要 1.7 秒',
'The previous video has no usable continuation data. Generate it again with this version of FreeVideo.': '上一段视频缺少可用的接续数据',
@@ -316,14 +363,18 @@ FAILURE_MESSAGES_ZH = {
}
-def failure_reason(error):
- if isinstance(error.get('error_zh'), str) and error['error_zh'].strip():
- return error['error_zh']
+def _failure_line(error):
lines = str(error.get('message') or '').strip().splitlines()
line = lines[0] if lines else ''
if line.startswith('FreeVideo generation failed') and len(lines) > 1:
line = lines[1].strip()
- line = re.sub(r'^(?:[\w.]*Error|[\w.]*Exception):\s*', '', line)
+ return re.sub(r'^(?:[\w.]*Error|[\w.]*Exception):\s*', '', line)
+
+
+def failure_reason(error):
+ if isinstance(error.get('error_zh'), str) and error['error_zh'].strip():
+ return error['error_zh']
+ line = _failure_line(error)
if line in FAILURE_MESSAGES_ZH:
return FAILURE_MESSAGES_ZH[line]
if line.startswith(('CUDA out of memory', 'MPS backend out of memory')):
@@ -331,8 +382,24 @@ def failure_reason(error):
return FAILURE_REASONS_ZH.get(error.get('code'), '没有完成')
+# The same lookup in English for the page: the specific sentences are already written for people.
+def failure_reason_en(error):
+ if isinstance(error.get('error_en'), str) and error['error_en'].strip():
+ return error['error_en']
+ line = _failure_line(error)
+ if line in FAILURE_MESSAGES_ZH:
+ return line
+ if line.startswith(('CUDA out of memory', 'MPS backend out of memory')):
+ return FAILURE_REASONS_EN['out_of_memory']
+ return FAILURE_REASONS_EN.get(error.get('code'), 'Did not finish')
+
+
+def reasons(error):
+ return dict(error_zh=failure_reason(error), error_en=failure_reason_en(error))
+
+
def with_reason(error):
- return dict(error, error_zh=failure_reason(error)) if error else error
+ return dict(error, **reasons(error)) if error else error
def build(code, *, details=None, request=None, validation=False, message=None, next_action=None,
diff --git a/freevideo_engine/agent/jobs.py b/freevideo_engine/agent/jobs.py
index 8328b1c..aad1a92 100644
--- a/freevideo_engine/agent/jobs.py
+++ b/freevideo_engine/agent/jobs.py
@@ -633,16 +633,16 @@ class Jobs:
report_id = error.get('report_id')
if code == 'invalid_json' and row['kind'] in ('vlm', 'enhance'):
code = 'vlm_invalid_json'
- reason_zh = errors.failure_reason(dict(error, code=code))
+ reason_zh, reason_en = errors.failure_reason(dict(error, code=code)), errors.failure_reason_en(dict(error, code=code))
if code != error.get('code') or not error.get('request_id') or row['kind'] == 'image':
error = errors.build(code, details=error.get('details'),
request=row.get('request_id'), action_required=code != 'cancelled',
kind=row['kind'], stage='terminal', resumable=not row['spec'].get('refine_from'),
report_id=error.get('report_id'))
if row['kind'] == 'image':
- reason_zh = error['error_zh']
+ reason_zh, reason_en = error['error_zh'], error['error_en']
if error is not None:
- error = dict(error, request_id=row.get('request_id') or error['request_id'], error_zh=reason_zh)
+ error = dict(error, request_id=row.get('request_id') or error['request_id'], error_zh=reason_zh, error_en=reason_en)
if row['kind'] != 'image' and isinstance(report_id, str) and re.fullmatch(r'[a-f0-9]{32}', report_id):
error['report_id'] = report_id
if error.get('next'):
@@ -1123,7 +1123,7 @@ class Jobs:
details=result['error'].get('details'), request=row.get('request_id'),
action_required=result['error']['code'] != 'cancelled', report_id=row['error'].get('report_id'))
else:
- result['error'] = dict(result['error'], error_zh=errors.failure_reason(row['error']))
+ result['error'] = dict(result['error'], **errors.reasons(row['error']))
report_id = row['error'].get('report_id')
if isinstance(report_id, str) and re.fullmatch(r'[a-f0-9]{32}', report_id):
result['error']['report_id'] = report_id
@@ -1808,7 +1808,7 @@ class Jobs:
next_action = 'Use the alternatives in details to lower size or duration, then POST /freevideo/agent/v1/jobs.'
failure = dict(chain_error(code, errors.ERRORS[code][2], next_action, details=[detail],
retryable=code != 'insufficient_memory').view(),
- error_zh=errors.failure_reason(dict(code=code, message=message)))
+ **errors.reasons(dict(code=code, message=message)))
if isinstance(report_id, str) and re.fullmatch(r'[a-f0-9]{32}', report_id):
failure['report_id'] = report_id
return failure
diff --git a/freevideo_engine/agent/productions.py b/freevideo_engine/agent/productions.py
index fcfb811..416d76d 100644
--- a/freevideo_engine/agent/productions.py
+++ b/freevideo_engine/agent/productions.py
@@ -145,7 +145,7 @@ def _safe_error(error):
rows = [_safe_row(row) for row in details] if isinstance(details, list) and details else []
if rows and all(rows):
result.update(details=rows, message='; '.join(row['message'] for row in rows))
- return dict(result, error_zh=errors.failure_reason(error))
+ return dict(result, **errors.reasons(error))
def failure(view):
@@ -628,7 +628,7 @@ class Productions:
value['progress'] = self._progress(record)
value['over_budget'] = self._elapsed_budget(value['progress'])
error, _ = failure(value)
- value['error_zh'] = errors.failure_reason(error) if error else None
+ value['error_zh'], value['error_en'] = (errors.failure_reason(error), errors.failure_reason_en(error)) if error else (None, None)
return value
def get(self, identity, *, since=None, wait=0, compact=True):
@@ -654,7 +654,7 @@ class Productions:
join = next((j for j in state['joins'] if j['ref'] == state['current_join']), None)
error, _ = failure(dict(stalled=record.get('stalled'), join=join, shots=state['shots']))
if error:
- value['error_zh'] = errors.failure_reason(error)
+ value.update(errors.reasons(error))
return value
return dict(self._view(record), changed=changed)
@@ -704,7 +704,7 @@ class Productions:
shot = next((s for s in view['shots'] if s['chosen'] is None), view['shots'][-1])
result.append(dict(id=view['id'], title=view['title'], status=view['status'], revision=view['revision'],
shot=shot['index'], shots=len(view['shots']), next=view['todo'][0] if view['todo'] else None,
- paused=view['paused'], stalled=view['stalled'], session=record.get('session'), error_zh=view['error_zh']))
+ paused=view['paused'], stalled=view['stalled'], session=record.get('session'), error_zh=view['error_zh'], error_en=view['error_en']))
return result
def _mutate(self, action, identity, *, by, ref=None, client=None, **values):
diff --git a/freevideo_engine/agent/routes.py b/freevideo_engine/agent/routes.py
index 2947198..f0da626 100644
--- a/freevideo_engine/agent/routes.py
+++ b/freevideo_engine/agent/routes.py
@@ -1049,6 +1049,7 @@ def register():
if done is None:
# Nothing is kept: no agent has connected since FreeVideo started, so nobody would read it.
return reply({'error': dict(code='not_connected', message='No agent is connected.', retryable=True,
+ error_zh='尚未连接 Agent', error_en='No agent is connected.',
details=[], next='Connect an agent in the Autopilot view, then say it again.',
request_id=errors.request_id())}, 409)
return reply(done[1], done[0])
@@ -1132,6 +1133,7 @@ def register():
done = await asyncio.to_thread(write)
if done is None:
return reply({'error': dict(code='not_connected', message='No agent is connected.', retryable=True,
+ error_zh='尚未连接 Agent', error_en='No agent is connected.',
details=[], next='Connect an agent in the Autopilot view, then try again.',
request_id=errors.request_id())}, 409)
return reply(done[1], done[0])
diff --git a/freevideo_engine/agent/schema.py b/freevideo_engine/agent/schema.py
index 8ef43f4..31a41fb 100644
--- a/freevideo_engine/agent/schema.py
+++ b/freevideo_engine/agent/schema.py
@@ -584,7 +584,7 @@ def cast_view():
description=nullable(string(1000)), revision=number(1, integer=True),
images=array(picture, 0, 6), candidates=array(picture, 0, 6),
generating=nullable(generating), generated=nullable(generated),
- generate_error=nullable(obj(dict(code=string(), job=JOB, message=string(), error_zh=string()), ('code', 'job', 'message')))),
+ generate_error=nullable(obj(dict(code=string(), job=JOB, message=string(), error_zh=string(), error_en=string()), ('code', 'job', 'message')))),
('id', 'kind', 'name', 'revision', 'images', 'candidates', 'generating')), additionalProperties=True)
@@ -1439,7 +1439,7 @@ def openapi():
'description': 'Image diagnostic report ID, or null when no report exists.'},
request_id=string(), docs=string(), retry_after_seconds=number(0), card={'type': 'object'}, job=JOB,
project={'type': 'object'}, current_revision=number(1, integer=True),
- error_zh=string()),
+ error_zh=string(), error_en=string()),
('code', 'message', 'details', 'retryable', 'request_id', 'docs'))}))
diff --git a/web/agent_activity.js b/web/agent_activity.js
index 37c7507..4cd4dd3 100644
--- a/web/agent_activity.js
+++ b/web/agent_activity.js
@@ -77,7 +77,7 @@ function row(job, t, api, refresh, open, cancellationErrors) {
if (job.status === 'running' && p.remaining_seconds > 0) meta.push(left(p.remaining_seconds, t));
const reason = job.status === 'failed' && REASONS[job.error?.code];
if (reason) meta.push(t(...reason));
- else if (job.status === 'failed') meta.push(t(job.error?.message || 'Did not finish', job.error?.error_zh || '没有完成'));
+ else if (job.status === 'failed') meta.push(t(job.error?.error_en || 'Did not finish', job.error?.error_zh || '没有完成'));
if (job.project) meta.push(job.project);
const foot = el('div', 'fv-agent-foot');
const details = el('p', 'fv-agent-meta', meta.join(' · '));
diff --git a/web/autopilot_chat.js b/web/autopilot_chat.js
index 30ccd53..06569fa 100644
--- a/web/autopilot_chat.js
+++ b/web/autopilot_chat.js
@@ -51,10 +51,12 @@ const WHITEBOX = {
const GENERIC_FAILURE_ZH = '没有完成';
// Sends and failure cards use the same public reason, including the engine's Chinese mapping.
function failureReason(value, t) {
- const error = value.error, reason = error?.error_zh || value.error_zh;
+ const error = value.error, reason = error?.error_zh || value.error_zh, reasonEn = error?.error_en || value.error_en;
if (error?.code === 'session_full' && (!reason || reason === GENERIC_FAILURE_ZH))
return t('This chat is full. Click "New chat".', '这个对话已满,请点“新对话”。');
- return t(error?.message || 'Did not finish', reason || GENERIC_FAILURE_ZH);
+ // `message` is written for programs; people read the engine's own English reason. A refusal the engine
+ // did not classify keeps its sentence, as before.
+ return t(reasonEn || error?.message || 'Did not finish', reason || GENERIC_FAILURE_ZH);
}
export {about};