{"record":{"id":"2a26e3b8b0a8685f","repo":"santifer/career-ops","slug":"apify-entry-entry-name-has-invalid-field-map","errorCode":null,"errorMessage":"apify: entry ${entry.name} has invalid field_map. Each of title, url, company, location, description must be a string or a non-empty array of strings. title and url are required.","messagePattern":"apify: entry (.+?) has invalid field_map\\. Each of title, url, company, location, description must be a string or a non-empty array of strings\\. title and url are required\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/apify/index.mjs","lineNumber":195,"sourceCode":"    detect() { return null; },\n\n    async fetch(entry, ctx) {\n      const token = ctx?.env?.APIFY_TOKEN || process.env.APIFY_TOKEN;\n      if (!hasToken(token)) {\n        throw new Error('APIFY_TOKEN not set — enable apify in config/plugins.yml and add the token to .env');\n      }\n      if (!entry.actor) {\n        throw new Error(`apify: entry ${entry.name} missing 'actor' (e.g. misceres/indeed-scraper)`);\n      }\n      if (\n        !entry.field_map ||\n        !isFieldSpec(entry.field_map.title) ||\n        !isFieldSpec(entry.field_map.url) ||\n        (entry.field_map.company != null && !isFieldSpec(entry.field_map.company)) ||\n        (entry.field_map.location != null && !isFieldSpec(entry.field_map.location)) ||\n        (entry.field_map.description != null && !isFieldSpec(entry.field_map.description))\n      ) {\n        throw new Error(\n          `apify: entry ${entry.name} has invalid field_map. Each of title, url, company, ` +\n          `location, description must be a string or a non-empty array of strings. title and url are required.`\n        );\n      }\n\n      const opts = { token };\n      if (entry.timeout_ms != null) opts.timeoutMs = entry.timeout_ms;\n      const items = await runActor(entry.actor, entry.input || {}, opts);\n\n      const useLocalJd = entry.field_map.description != null;\n      const sourceLabel = String(entry.actor || 'apify').replace(/[^a-z0-9]+/gi, '-').toLowerCase();\n\n      return items\n        .map(item => {\n          const normalized = normalizeItem(item, entry.field_map, entry.defaults);\n          if (!normalized.title || !normalized.url) return null;\n          if (!isHttpsUrl(normalized.url)) return null;\n          if (!useLocalJd) return normalized;","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/plugins/apify/index.mjs#L177-L213","documentation":"The apify plugin validates each entry's field_map: title and url are required, and title, url, company, location, description (when present) must each be a string or a non-empty array of strings. Any violation throws this descriptive error.","triggerScenarios":"Config entry where field_map is absent, title/url missing, or any mapped field is a number, empty array, nested object, or array containing non-strings.","commonSituations":"Writing field_map values as comma-separated strings expecting splitting; leaving an empty array after removing a dataset field; typo'ing a key (e.g. feild_map); specifying company: [] for optional fields.","solutions":["Ensure title and url are present and each field is a string or non-empty array of strings, e.g. field_map: { title: 'positionName', url: 'url', company: ['company','name'] }.","Remove optional fields (company/location/description) entirely rather than setting them to invalid values.","Check the dataset's actual output fields in the Apify console and map to real key names.","Validate the YAML/JSON parses as intended (indentation can turn strings into nested structures)."],"exampleFix":"// before\nfield_map:\n  title:\n  url: url\n  company: []\n// after\nfield_map:\n  title: positionName\n  url: url\n  company: company","handlingStrategy":"validation","validationCode":"const isFieldSpec = (v) => typeof v === 'string' || (Array.isArray(v) && v.length > 0 && v.every(x => typeof x === 'string'));\nif (!isFieldSpec(entry.field_map?.title) || !isFieldSpec(entry.field_map?.url)) throw new Error('invalid field_map');","typeGuard":"const validFieldMap = (fm) => !!fm && isFieldSpec(fm.title) && isFieldSpec(fm.url) && ['company','location','description'].every(k => fm[k] == null || isFieldSpec(fm[k]));","tryCatchPattern":"try {\n  await scanner.run(config);\n} catch (e) {\n  if (String(e.message).includes('invalid field_map')) {\n    console.error('Check field_map: strings or non-empty string arrays; title & url required');\n  }\n  throw e;\n}","preventionTips":["Validate field_map with a schema validator at config load time.","Cross-check mapped keys against the actor's actual dataset fields in the Apify console.","Avoid empty arrays for optional fields — omit the key instead.","Test one entry end-to-end before adding many."],"tags":["apify","config","validation","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}