{"record":{"id":"6b54444d60543fa5","repo":"toeverything/AFFiNE","slug":"invalidarg-6b5444","errorCode":"InvalidArg","errorMessage":"unsupported import source kind: {kind}","messagePattern":"unsupported import source kind: (.+?)","errorType":"exception","errorClass":"napi::Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/native/src/import/session.rs","lineNumber":64,"sourceCode":"  let status = match error {\n    affine_importer::ImportError::Cancelled => Status::Cancelled,\n    affine_importer::ImportError::UnsupportedFormat(_) | affine_importer::ImportError::InvalidSource(_) => {\n      Status::InvalidArg\n    }\n    affine_importer::ImportError::Zip(_)\n    | affine_importer::ImportError::Io(_)\n    | affine_importer::ImportError::Document(_) => Status::GenericFailure,\n  };\n  Error::new(status, error.to_string())\n}\n\n#[napi]\npub fn create_import_session(options: CreateImportSessionOptions) -> Result<String> {\n  let source = match options.source.kind.as_str() {\n    \"filePath\" => ImportSource::FilePath(PathBuf::from(options.source.path)),\n    \"directoryPath\" => ImportSource::DirectoryPath(PathBuf::from(options.source.path)),\n    kind => {\n      return Err(Error::new(\n        Status::InvalidArg,\n        format!(\"unsupported import source kind: {kind}\"),\n      ));\n    }\n  };\n  let mut batch_limits = ImportBatchLimits::default();\n  if let Some(limits) = options.batch_limits {\n    if let Some(max_docs) = limits.max_docs {\n      batch_limits.max_docs = max_docs as usize;\n    }\n    if let Some(max_blobs) = limits.max_blobs {\n      batch_limits.max_blobs = max_blobs as usize;\n    }\n    if let Some(max_blob_bytes) = limits.max_blob_bytes {\n      if !(0..=100 * 1024 * 1024).contains(&max_blob_bytes) {\n        return Err(Error::new(Status::InvalidArg, \"maxBlobBytes not valid\"));\n      }\n      batch_limits.max_blob_bytes = max_blob_bytes as u64;","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/native/src/import/session.rs#L46-L82","documentation":"Sentinel error in the napi `create_import_session` entry point: the caller-supplied `options.source.kind` string did not match any of the supported import source kinds handled in the match (e.g. 'filePath'), so no import session can be constructed. The faulting input is the unrecognized `kind` string in the import source descriptor.","triggerScenarios":"Raised in create_import_session when options.source.kind is neither filePath nor directoryPath.","commonSituations":"The import request used an unknown source kind. Use filePath or directoryPath when starting an import session.","solutions":["Use a supported import source kind.","Add a handler for the new import kind."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}