{"record":{"id":"570b7cc53f2105c5","repo":"nexu-io/open-design","slug":"refresh-source-source-type-is-not-supported-yet","errorCode":null,"errorMessage":"refresh source ${source.type} is not supported yet","messagePattern":"refresh source (.+?) is not supported yet","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/daemon/src/live-artifacts/refresh-service.ts","lineNumber":103,"sourceCode":"  if (source.type === 'connector_tool') {\n    const connector = source.connector;\n    if (connector === undefined) throw new Error('connector refresh source requires connector metadata');\n    const result = await connectorService.execute(\n      {\n        connectorId: connector.connectorId,\n        toolName: connector.toolName,\n        input: source.input,\n        ...(connector.accountLabel === undefined ? {} : { expectedAccountLabel: connector.accountLabel }),\n      },\n      { projectsRoot, projectId, purpose: 'artifact_refresh', signal },\n    );\n    if (result.output === null || typeof result.output !== 'object' || Array.isArray(result.output)) {\n      throw new Error('connector refresh output must be a JSON object');\n    }\n    return result.output;\n  }\n  if (source.type !== 'daemon_tool' && source.type !== 'local_file') {\n    throw new Error(`refresh source ${source.type} is not supported yet`);\n  }\n  return executeLocalDaemonRefreshSource({ projectsRoot, projectId, source, signal });\n}\n\nexport async function refreshLiveArtifact(options: RefreshLiveArtifactOptions): Promise<RefreshLiveArtifactResult> {\n  return withLiveArtifactRefreshLock(options, async (lock) => {\n    const refreshId = lock.metadata.refreshId;\n    let sequence = 0;\n\n    const appendLog = async (entry: {\n      step: string;\n      status: 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';\n      startedAt: Date;\n      finishedAt?: Date;\n      source?: LiveArtifactRefreshSourceMetadata;\n      error?: unknown;\n      metadata?: BoundedJsonObject;\n    }): Promise<void> => {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/live-artifacts/refresh-service.ts#L85-L121","documentation":"executeRefreshSource (refresh-service.ts:102-103) first handles type 'connector_tool', then accepts only 'daemon_tool' and 'local_file'. Any other source.type falls through to this guard. It is a defensive check for refresh source types that have no execution implementation yet.","triggerScenarios":"executeRefreshSource is invoked with a LiveArtifactSource whose .type is neither 'connector_tool', 'daemon_tool', nor 'local_file' (e.g. a newly introduced type like 'http_endpoint' before its execution branch exists, or a corrupted/malformed source.type value).","commonSituations":"A new source type was added to isSupportedSource without adding its execution branch; a test or external caller constructs a source with an arbitrary type string; persisted artifact data has a source.type from a newer/older schema version.","solutions":["Use one of the supported source types: 'local_file', 'daemon_tool', or 'connector_tool'.","If introducing a new source type, implement its execution branch in executeRefreshSource in the same change that you add it to isSupportedSource."],"exampleFix":"// before\nconst source = { type: 'http_endpoint', input: { url: '...' } };\nawait executeRefreshSource({ ..., source, signal });\n// throws `refresh source http_endpoint is not supported yet`\n\n// after: use a supported type\nconst source = { type: 'daemon_tool', toolName: 'project_files.read_json', input: { path: 'data.json' } };","handlingStrategy":"validation","validationCode":"const SUPPORTED_REFRESH_TYPES = new Set(['local_file', 'daemon_tool', 'connector_tool']);\nfunction isRefreshableSourceType(source: { type: string }): boolean {\n  return SUPPORTED_REFRESH_TYPES.has(source.type);\n}\nif (!isRefreshableSourceType(source)) {\n  throw new Error(`Unsupported refresh source type: ${source.type}`);\n}","typeGuard":"function isSupportedRefreshSource(source: unknown): source is { type: 'local_file' | 'daemon_tool' | 'connector_tool' } {\n  return typeof source === 'object' && source !== null\n    && ['local_file', 'daemon_tool', 'connector_tool'].includes((source as { type: string }).type);\n}","tryCatchPattern":null,"preventionTips":["When adding a new LiveArtifactSource type, implement its execution branch in executeRefreshSource in the same PR you enable it in isSupportedSource.","Gate any direct call to executeRefreshSource behind a supported-type check.","Unit-test executeRefreshSource against each supported type plus one unsupported type."],"tags":["live-artifacts","refresh","source-type","not-implemented"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}